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();
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
License
MIT