mirror of
https://github.com/scratchfoundation/restify-cors-middleware.git
synced 2025-03-07 01:57:55 -05:00
Create README.md
This commit is contained in:
parent
635d779252
commit
3c7dec4e63
1 changed files with 23 additions and 0 deletions
23
README.md
Normal file
23
README.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# restify-cors-middleware
|
||||
|
||||
> CORS middleware with full [W3C spec](www.w3.org/TR/cors) support.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var corsMiddleware = require('restify-cors-middleware');
|
||||
|
||||
var cors = corsMiddleware({
|
||||
origins: ['http://api.myapp.com', 'http://web.myapp.com'],
|
||||
allowHeaders: ['API-Token'],
|
||||
exposeHeaders: ['API-Token-Expiry']
|
||||
});
|
||||
|
||||
server.pre(cors.preflight);
|
||||
server.use(cors.actual);
|
||||
```
|
||||
|
||||
## Compliance to the spec
|
||||
|
||||
See [unit tests](https://github.com/TabDigital/restify-cors-middleware/tree/master/test)
|
||||
for examples of preflight and actual requests.
|
Loading…
Reference in a new issue