Skip to content
Gilbert edited this page Jul 2, 2015 · 1 revision

Cookie sessions are useful if your client code is running on the same domain as your server. Since they store credentials in an encrypted cookie value, no database is required.

$ npm install cookie-session

Add the following to your server/index.js file:

var session = require('cookie-session')
app.use(session({
  name: 'my-app:session',
  secret: process.env.SESSION_SECRET || 'development',
  secure: (!! process.env.SESSION_SECRET),
  signed: true
}))
Clone this wiki locally