add a lot of server side libraries, preemptively, still hooking everything up

This commit is contained in:
catarak 2016-05-17 15:50:37 -04:00
parent 33fcafb483
commit ea83c2ba0b
2 changed files with 16 additions and 7 deletions

View file

@ -1,20 +1,13 @@
import { Router } from 'express';
import * as SessionController from '../controllers/session.controller';
<<<<<<< HEAD
import passport from 'passport';
=======
>>>>>>> add framework for sessions
const router = new Router();
router.route('/login').get(SessionController.newSession);
<<<<<<< HEAD
router.route('/login').post(SessionController.createSession);
router.route('/logout').get(SessionController.destroySession);
//TODO add github authentication stuff
=======
router.route('/logout').get(SessionController.destroySession);
>>>>>>> add framework for sessions

View file

@ -26,10 +26,24 @@ import users from './routes/user.routes';
//Body parser, cookie parser, sessions, serve public assets
//Body parser, cookie parser, sessions, serve public assets
const MongoStore = require('connect-mongo')(session);
app.use(Express.static(path.resolve(__dirname, '../static')));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(session({
//this should be SECRET AND IN A SECRET FILE
//TODO add dotenv
secret: 'steve brule',
resave: true,
saveUninitialized: true,
store: new MongoStore({
// url: process.env.MONGODB_URI || process.env.MONGOLAB_URI,
url: serverConfig.mongoURL,
autoReconnect: true
})
}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', users);
@ -44,6 +58,8 @@ mongoose.connection.on('error', () => {
process.exit(1);
});
const passportConfig = require('./config/passport');
app.get("/", function(req, res) {
res.sendFile(path.resolve(__dirname + '/../index.html'));
})