This repository was archived by the owner on Apr 26, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ # hapi-cors-headers
2
+
3
+ > hapi extension to enable CORS
4
+
5
+ [ ![ NPM version] ( https://badge.fury.io/js/hapi-cors-headers.svg )] ( https://www.npmjs.com/package/hapi-cors-headers )
6
+ [ ![ Build Status] ( https://travis-ci.org/gr2m/hapi-cors-headers.svg?branch=master )] ( https://travis-ci.org/gr2m/hapi-cors-headers )
7
+ [ ![ Coverage Status] ( https://coveralls.io/repos/gr2m/hapi-cors-headers/badge.svg?branch=master )] ( https://coveralls.io/r/gr2m/hapi-cors-headers?branch=master )
8
+ [ ![ Dependency Status] ( https://david-dm.org/hoodiehq/pouchdb-hoodie-api.svg )] ( https://david-dm.org/hoodiehq/pouchdb-hoodie-api )
9
+
10
+ Enables [ CORS] ( https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS ) on
11
+ all server response, securely from all origins, with ` access-control-allow-credentials: true ` .
12
+
13
+ ## Example
14
+
15
+ ``` js
16
+ var Hapi = require (' hapi' )
17
+ var corsHeaders = require (' hapi-cors-headers' )
18
+
19
+ var server = new Hapi.Server ()
20
+ // setup routes etc ...
21
+
22
+ server .ext (' onPreResponse' , addCorsHeaders)
23
+ ```
24
+
25
+ ## Install
26
+
27
+ ``` bash
28
+ npm install --save hapi-cors-headers
29
+ ```
30
+
31
+ ## Test
32
+
33
+ [ ![ devDependency Status] ( https://david-dm.org/hoodiehq/pouchdb-hoodie-api/dev-status.svg )] ( https://david-dm.org/hoodiehq/pouchdb-hoodie-api#info=devDependencies )
34
+
35
+ ``` bash
36
+ npm test
37
+ ```
You can’t perform that action at this time.
0 commit comments