@tinyhttp/cors
Advanced tools
Comparing version 0.2.16 to 0.2.17
# @tinyhttp/cors | ||
## 0.2.17 | ||
### Patch Changes | ||
- Create ip-filter package | ||
## 0.2.16 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@tinyhttp/cors", | ||
"version": "0.2.16", | ||
"version": "0.2.17", | ||
"description": "tinyhttp CORS module", | ||
@@ -5,0 +5,0 @@ "type": "module", |
# @tinyhttp/cors | ||
[![npm (scoped)](https://img.shields.io/npm/v/@tinyhttp/cors?style=flat-square)](https://npmjs.com/package/@tinyhttp/cors) [![npm](https://img.shields.io/npm/dt/@tinyhttp/cors?style=flat-square)](https://npmjs.com/package/@tinyhttp/cors) | ||
[![npm (scoped)][badge-url]][npm-url] [![npm][dl-badge-url]][npm-url] | ||
@@ -23,12 +23,12 @@ > A rewrite of [expressjs/cors](https://github.com/expressjs/cors) module. | ||
Returns the Cors middleware with the settings specified in the parameters | ||
Returns the CORS middleware with the settings specified in the parameters | ||
#### Options | ||
- `origin`: Can be a string defining the Access-Control-Allow-Origin value, a boolean which if set to true sets the header to `'*'` or a function which contains the request and response as parameters and must return the value for the Access-Control-Allow-Origin header | ||
- `methods`: Array of method names which define the Access-Control-Allow-Methods header, default to all the most common methods (get, head, put, patch, post, delete) | ||
- `allowedHeaders`: Configures the Access-Control-Allow-Headers CORS header. Expects an array (ex: ['Content-Type', 'Authorization']). | ||
- `exposedHeaders`: Configures the Access-Control-Expose-Headers CORS header. If not specified, no custom headers are exposed | ||
- `credentials`: Configures the Access-Control-Allow-Credentials CORS header. Set to true to pass the header, otherwise it is omitted. | ||
- `maxAge`: Configures the Access-Control-Max-Age CORS header. Set to an integer to pass the header, otherwise it is omitted. | ||
- `origin`: Can be a string defining the `Access-Control-Allow-Origin` value, a boolean which if set to true sets the header to `'*'` or a function which contains the request and response as parameters and must return the value for the `Access-Control-Allow-Origin` header | ||
- `methods`: Array of method names which define the `Access-Control-Allow-Methods` header, default to all the most common methods (`GET`, `HEAD`, `PUT`, `PATCH`, `POST`, `DELETE`) | ||
- `allowedHeaders`: Configures the `Access-Control-Allow-Headers` CORS header. Expects an array (ex: [`'Content-Type'`, `'Authorization'`]). | ||
- `exposedHeaders`: Configures the `Access-Control-Expose-Headers` CORS header. If not specified, no custom headers are exposed | ||
- `credentials`: Configures the `Access-Control-Allow-Credentials` CORS header. Set to true to pass the header, otherwise it is omitted. | ||
- `maxAge`: Configures the `Access-Control-Max-Age` CORS header. Set to an integer to pass the header, otherwise it is omitted. | ||
- `optionsSuccessStatus`: Provides a status code to use for successful OPTIONS requests, since some legacy browsers (IE11, various SmartTVs) choke on 204. | ||
@@ -61,3 +61,3 @@ | ||
app.listen(8080) | ||
app.listen(3000) | ||
``` | ||
@@ -68,1 +68,5 @@ | ||
MIT © [BRA1L0R](https://brailor.me/) | ||
[badge-url]: https://img.shields.io/npm/v/@tinyhttp/cors?style=flat-square | ||
[npm-url]: https://npmjs.com/package/@tinyhttp/cors | ||
[dl-badge-url]: https://img.shields.io/npm/dt/@tinyhttp/cors?style=flat-square |
10675
70