Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/broucz/koa-xframe

X-Frame-Options HTTP response header utility for Koa
https://github.com/broucz/koa-xframe

Last synced: 29 days ago
JSON representation

X-Frame-Options HTTP response header utility for Koa

Awesome Lists containing this project

README

        

# Koa XFrame

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]

[X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options) HTTP response header utility for Koa.

:bulb:**This middleware is designed for [Koa](https://github.com/koajs/koa) v2.x.x and use [Babel](https://babeljs.io/) for ES5 compatibility.**

:wrench:**This middleware is a work-in-progress**. Feedback / PR are welcome and encouraged. If you'd like to collaborate on this project, let me know.

## Installation

```
$ npm install --save koa-xframe
```

## Usage & API

```js
import Koa from 'koa';
import xFrame from 'koa-xframe';

const app = new Koa();

// default settings -> set X-Frame-Options to 'DENY'
app.use(xFrame());

// custom settings
// -> set X-Frame-Options to 'DENY'
app.use(xFrame('DENY'));
// -> set X-Frame-Options to 'SAMEORIGIN'
app.use(xFrame('SAMEORIGIN'));
```

## Credits

Inspired by [Koala headers.js middleware](https://github.com/koajs/koala/blob/master/lib/middleware/headers.js).

## License

[MIT](LICENSE)

[npm-image]: https://img.shields.io/npm/v/koa-xframe.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-xframe
[travis-image]:https://img.shields.io/travis/broucz/koa-xframe.svg?style=flat-square
[travis-url]: https://travis-ci.org/broucz/koa-xframe
[coveralls-image]: https://img.shields.io/coveralls/broucz/koa-xframe.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/broucz/koa-xframe?branch=master
[david-image]: https://img.shields.io/david/broucz/koa-xframe.svg?style=flat-square
[david-url]: https://david-dm.org/broucz/koa-xframe
[download-image]: https://img.shields.io/npm/dm/koa-xframe.svg?style=flat-square
[download-url]: https://npmjs.org/package/koa-xframe