npm install helmet code example

Example 1: what is helmet package for

Helmet is actually just a collection of smaller middleware functions that set security-related HTTP response headers: csp sets the Content-Security-Policy header to help prevent cross-site scripting attacks and other cross-site injections. hidePoweredBy removes the X-Powered-By header.

Example 2: helmet npm

// Installation
// npm install helmet --save

// Quick start
const express = require("express");
const helmet = require("helmet");

const app = express();

app.use(helmet());

// ...

Tags:

Misc Example