Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goto-bus-stop/micro-helmet
security headers for micro
https://github.com/goto-bus-stop/micro-helmet
csp headers helmet hsts http http-headers micro security
Last synced: about 2 months ago
JSON representation
security headers for micro
- Host: GitHub
- URL: https://github.com/goto-bus-stop/micro-helmet
- Owner: goto-bus-stop
- License: other
- Created: 2019-06-15T10:00:39.000Z (over 5 years ago)
- Default Branch: default
- Last Pushed: 2023-05-31T04:59:07.000Z (over 1 year ago)
- Last Synced: 2024-07-05T15:21:36.050Z (3 months ago)
- Topics: csp, headers, helmet, hsts, http, http-headers, micro, security
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-micro - micro-helmet - Security headers for micro, using the popular [Helmet](https://www.npmjs.com/package/helmet) module (Modules / Utilities)
README
# micro-helmet
security headers for micro using [helmet](https://github.com/helmetjs/helmet)
requires node.js 10+
[Install](#install) - [Usage](#usage) - [License: Apache-2.0](#license)
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url][npm-image]: https://img.shields.io/npm/v/micro-helmet.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/micro-helmet
[travis-image]: https://img.shields.io/travis/com/goto-bus-stop/micro-helmet.svg?style=flat-square
[travis-url]: https://travis-ci.com/goto-bus-stop/micro-helmet
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard## Install
```
npm install micro-helmet
```## Usage
As a wrapper function:
```js
var helmet = require('micro-helmet')module.exports = helmet(async (req, res) => {
return { ok: true }
})
```As a utility:
```js
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](https://github.com/helmetjs/helmet#how-it-works).### `await helmet.addHeaders(req, res, opts={})`
Add helmet's headers.
`opts` can be used to configure specific headers. It is passed through to [helmet](https://github.com/helmetjs/helmet#how-it-works).## License
[Apache-2.0](LICENSE.md)