Node.js Connect middleware to sanitize user input coming from POST body, GET queries, and url params.
npm install xss-purge
With Express (JS)
const express = require('express'); const xssPurge = require('xss-purge'); const app = express(); app.use(xssPurge()); app.listen(5000)
This will sanitize any data in req.body, req.query, and req.params. You can also access the API directly if you don't want to use as middleware.