Sanitizing Output
Learn how to sanitize your output in Node.js.
We'll cover the following...
Outputting to the browser
Take precautions when saving data you take in. Sanitize or escape any user-generated data that is output back to the browser.
You can modify and escape your data before saving to the database, or in between by retrieving and outputting it to the browser. This depends on how your data is edited and used. For example, if the user is editing the data later, it makes more sense to save as-is and sanitize upon output.
What security benefits come from escaping user-generated ...