/koa-helmet

Collection of middleware to implement various security headers for koa

Primary LanguageTypeScriptMIT LicenseMIT

koa-helmet

Version Dependency Status Build Status Downloads

koa-helmet is a wrapper for helmet to work with koa.

Installation

npm install koa-helmet --save

Usage

Usage is the same as helmet

Helmet offers 10 security middleware functions:

Running app.use(helmet()) will include 7 of the 10, leaving out contentSecurityPolicy, hpkp, and noCache. You can also use each module individually, as documented below.

Example

var Koa = require('koa');
var helmet = require('koa-helmet');
var app = new Koa();

app.use(helmet());

app.use((ctx) => {
  ctx.body = 'Hello World';
});

app.listen(4000);

Versioning

  • koa-helmet 2.x (master branch) supports koa 2.x
  • koa-helmet 1.x (koa-1 branch) supports koa 0.x and koa 1.x