diff --git a/server/index.js b/server/index.js index 386fca6..7f909cf 100644 --- a/server/index.js +++ b/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!')); \ No newline at end of file +server.listen(6000, () => { + console.log(chalk.green.bold('Server listening on port 6000!')); +});