hapi-cors-headers-k
v1.0.3-k
Published
hapi extension to enable CORS
Downloads
5
Readme
hapi-cors-headers
hapi extension to enable CORS
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
npm test