0.0.3 • Published 4 years ago
fomex-cors v0.0.3
Fomex Cors
Cross Origin Resource Sharing for fomex
Installation
yarn add fomex-cors
Usage
import { baseWebRouter } from 'fomex';
import { PluginCors } from 'fomex-cors';
export webRouter = baseWebRouter.global(new PluginCors());
Options
origin: \<string | Function>
To set header Access-Control-Allow-Origin
, default using value from header Origin
maxAge: \
To set header Access-Control-Max-Age
, default is 0
, means no cache
credentials: \<boolean | Function>
To set header Access-Control-Allow-Credentials
, default is false
.
allowMethods: \<string[]>
To set header Access-Control-Allow-Methods
, default is 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'
allowHeaders: \<string[]>
To set header Access-Control-Allow-Headers
, default using value from header Access-Control-Request-Headers
exposeHeaders: \<string[]>
To set header Access-Control-Expose-Headers
, default is empty
keepHeadersOnError: \
Always keep above headers you have set even if error thrown, default is true