When I first started learning PHP, you could use $_SESSION array to store information and use it on multiple sites, like setting a username of someone who has logged in.
Is there something like that for the MEAN stack?
When I first started learning PHP, you could use $_SESSION array to store information and use it on multiple sites, like setting a username of someone who has logged in.
Is there something like that for the MEAN stack?
Module to use express-session
var express = require('express');
var session = require('express-session');
var app = express();
initialize
app.use(session({secret: 'something'}));
sessionVariable in the below code is equivalent to $_SESSION in php.
var sessionVariable;
app.get('/',function(req,res){
sessionVariable=req.session;
sessionVariable.email = 'test@test.com;
sessionVariable.username = 'test';
});