Browse Source

Add basic config for app.js

cookie-session / bodyParser / authRoute / passport
main
Haris Razis 4 years ago
parent
commit
6219f1ac9d
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 29
      server/index.js

29
server/index.js

@ -1,12 +1,31 @@
const app = require('express')()
const server = require('http').createServer(app);
const bodyParser = require('body-parser');
const passport = require('./services/passport');
const chalk = require('chalk')
require('./services/socket')(server);
const measurementRoute = require('./routes/data')
const dataRoute = require('./routes/data')
const authRoute = require('./routes/data')
const {session_secret} = require('./config/keys');
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(
require('cookie-session')({
keys: [session_secret],
maxAge: 30 * 24 * 60 * 60 * 1000
})
);
app.use(passport.initialize(undefined));
app.use(passport.session(undefined));
app.use(measurementRoute)
app.use(dataRoute)
app.use(authRoute)
server.listen(6000);
console.log(chalk.green.bold('Server listening on port 6000!'));
server.listen(6000, () => {
console.log(chalk.green.bold('Server listening on port 6000!'));
});

Loading…
Cancel
Save