1.0.3-k • Published 2 years ago

hapi-cors-headers-k v1.0.3-k

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

1.0.3-k

2 years ago