0.0.4 • Published 5 years ago
express-session-with-placeholder v0.0.4
express-session-with-placeholder
Simple fork of express-session which adds a placeholder in the cookie in order to store additional information you do not want to store server-side.
Installation
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
$ npm install express-session-with-placeholder
Usage
You can use this package as the real express-session.
To use the placeholder just store your data in req.placeholder
.
app.post('/sign-in', (req, res) => {
// ...
req.placeholder = 'foo';
res.end();
});
Your placeholder is now stored in req.placeholder
if the cookie
is correctly set.
app.get('/bar', (req, res) => {
if (res.placeholder !== 'foo') {
return res.status(403).end();
}
return res.end('bar');
});