JavaScript Answers

How to prevent XSS in Node.js?

Spread the love

To prevent XSS in Node.js, we use the validator module.

For instance, we write

const validator = require("validator");

const escapedString = validator.escape(someString);

to call validator.escape with someString to return an escaped version of someString.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.