hapi-cors-headers-k

1.0.3-k • Public • Published

hapi-cors-headers

hapi extension to enable CORS

Build Status Coverage Status Greenkeeper badge

Enables CORS on all server response, securely from all origins, with access-control-allow-credentials: true.

Example

var Hapi = require('hapi');
const corsHeaders = require('hapi-cors-headers')('localhost:8888', logger);

var server = new Hapi.Server();
// setup routes etc ...

server.ext('onPreResponse', corsHeaders);

logger is option if not specified it will be console. The first arguments tells to cors-header to allow only on localhost:8888

Install

npm install --save hapi-cors-headers

Test

devDependency Status

npm test

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i hapi-cors-headers-k

Weekly Downloads

0

Version

1.0.3-k

License

MIT

Unpacked Size

11.2 kB

Total Files

7

Last publish

Collaborators

  • krysalead