Skip to content

goto-bus-stop/micro-helmet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro-helmet

security headers for micro using helmet

requires node.js 10+

Install - Usage - License: Apache-2.0

npm travis standard

Install

npm install micro-helmet

Usage

As a wrapper function:

var helmet = require('micro-helmet')

module.exports = helmet(async (req, res) => {
  return { ok: true }
})

As a utility:

var helmet = require('micro-helmet')

module.exports = async (req, res) => {
  await helmet.addHeaders(req, res)
  return { ok: true }
}

API

helmet(handler, opts={})

Wrap a handler function. This adds helmet's headers before calling your handler. opts can be used to configure specific headers. It is passed through to helmet.

await helmet.addHeaders(req, res, opts={})

Add helmet's headers. opts can be used to configure specific headers. It is passed through to helmet.

License

Apache-2.0