csrf.js 264 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 'use strict'; const csrf = require('csurf'); const csrfInit = csrf(); module.exports = (req, res, next) => { return csrfInit(req, res, (e) => { res.locals.csrfToken = req.csrfToken(); e && (e.code = 403); return next(e); }); };