Skip to content

Instantly share code, notes, and snippets.

@samrocksc
Forked from monteslu/cors.js
Created September 15, 2015 17:39
Show Gist options
  • Save samrocksc/ba77e15ac971e91831dc to your computer and use it in GitHub Desktop.
Save samrocksc/ba77e15ac971e91831dc to your computer and use it in GitHub Desktop.
hapi cors
{
method: 'POST',
path: '/dostuff',
config: {
auth: false,
cors: {
additionalHeaders: ['accept']
},
handler: handleStuff
}
},
// For preflight options requests
{
method: 'OPTIONS',
path: '/{p*}',
config: {
auth: false,
cors: true,
handler: function (request, reply) {
return reply('hi')
}
}
}
@samrocksc
Copy link
Author

or you can just npm install --save hapi-cors-headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment