Morgan Conrad

kepi

NPM package to set and manage response headers

Kepi is a lightweight NPM module to manage HTTP response headers (e.g. from Express).

Example usage:


// many of the headers can be declared in constants

let kepi = Kepi({
  'X-Powered-By': 'super duper system',
  'Content-Type': ['text/html', 'charset=utf-8']
  'Feature-Policy': {
    vibrate: "'none'",
    geolocation: "'self'",
  },
});

// you can add more later in a declarative fashion

kepi.add( { Content-Encoding: ['deflate', 'gzip']} );

// you can also be dynamic and set them programmatically

let methodArray = [ insert methods you allow here ]
kepi.accessControl.allowMethods().add(...methodArray);
kepi.header('Expires').set(Date.now() + 60*60*1000);  // good for one hour

...

app.use(kepi.middleware());

If you just want to mimic helmet

app.use(kepi().safe().middleware());

There are some customization options as well. NPM Module Here

Uses JavaScript nodejs NPM