UNPKG

guox-express

Version:

GuOx: Ultimate enterprise‑grade, AI & WASM‑powered Express security framework

10 lines (8 loc) 310 B
import csurf from 'csurf'; import { RequestHandler } from 'express'; export default function CSRF(cfg?: any): RequestHandler { const opts = { cookie:cfg?.cookie ?? true, header:cfg?.header ?? 'x-csrf-token' }; const mw = csurf(opts); Object.defineProperty(mw, 'name', { value: 'CSRF' }); return mw; }