Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. const express = require('express')
  2. const index = require('../routes/index.js')
  3. const app = express()
  4. const PORT = 3000
  5. const Session = require('express-session')
  6. const FileStore = require('session-file-store')(Session)
  7. const path = require('path')
  8.  
  9. app.use(Session({
  10. store: new FileStore({
  11. path: path.join(__dirname, '/tmp'),
  12. encrypt: true
  13. }),
  14. secret: 'Super Secret !',
  15. resave: true,
  16. saveUninitialized: true,
  17. name : 'sessionId'
  18. }));
  19.  
  20.  
  21. app.use('/', index)
  22.  
  23. app.get('/', (req, res) => {
  24. res.send('OK')
  25. })
  26.  
  27. app.listen(PORT, () => {
  28. console.log('Listening on port 3000')
  29. })
Add Comment
Please, Sign In to add comment