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 06ff0e3e31
commit eec7987c70

View file

@ -26,11 +26,24 @@ import users from './routes/user.routes';
//Body parser, cookie parser, sessions, serve public assets //Body parser, cookie parser, sessions, serve public assets
//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(Express.static(path.resolve(__dirname, '../static')));
app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(cookieParser()); app.use(cookieParser());
app.use(session({secret: 'steve brule'})); 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.initialize());
app.use(passport.session()); app.use(passport.session());
app.use(Express.static(path.resolve(__dirname, '../static'))); app.use(Express.static(path.resolve(__dirname, '../static')));
@ -51,6 +64,8 @@ mongoose.connection.on('error', () => {
process.exit(1); process.exit(1);
}); });
const passportConfig = require('./config/passport');
app.get("/", function(req, res) { app.get("/", function(req, res) {
res.sendFile(path.resolve(__dirname + '/../index.html')); res.sendFile(path.resolve(__dirname + '/../index.html'));
}) })