Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.use(express.cookieParser('shhhh, very secret'));
- app.use(express.session());
- app.use(cookieParser())
- app.use(session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
- connect()
- .use(connect.cookieParser('optional secret string'))
- .use(function(req, res, next){
- res.end(JSON.stringify(req.cookies));
- })
- connect()
- .use(connect.cookieParser())
- .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
- // backwards compatibility for signed cookies
- // req.secret is passed from the cookie parser middleware
- var secret = options.secret || req.secret;
- // ensure secret is available or bail
- if (!secret) throw new Error('`secret` option required for sessions');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement