Guest User

Untitled

a guest
Dec 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. var RedisStore = require('connect-redis')(express);
  2. app.use(express.bodyParser());
  3. app.use(express.cookieParser());
  4. app.use(express.session(
  5. { secret: "change_me", store: new RedisStore })
  6. );
  7.  
  8. app.post('/add-to-cart', function(req, res){
  9. // Perhaps we posted several items with a form
  10. // (use the bodyParser() middleware for this)
  11. var items = req.body.items;
  12. req.session.items = items;
  13. res.redirect('back');
  14. });
Add Comment
Please, Sign In to add comment