session
session copied to clipboard
Added: Promise return type for req.session.save() function
ping
What could be done to get this PR integrated?
One workaround is to add the promisified function via middleware:
import { promisify } from 'util';
...
// make "saveAsync" available to other routes
// could also be done via app.use()
router.use((req, _res, next) => {
req.session.saveAsync = promisify(req.session.save.bind(req.session));
next();
});
...
router.post('/xyz', async (req, res, next) => {
await req.session.saveAsync();
// do more stuff
});