Cookies

var cookieParser = require('cookie-parser');// We place them as middleware, so that each request have access to cookies from the browser.app.use(cookieParser());
app.use((req, res, next) => {// this creates a cookie named username in browser with value 'xyz'.res.cookie('username', 'xyz');})
How cookies look in Chrome Developer Tools

Session

Full Stack JavaScript Developer | Ex-Credilio | @AltCampus Alumni