0.0.3 • Published 4 years ago

fomex-cors v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Fomex Cors

Cross Origin Resource Sharing for fomex

License GitHub Workflow Status (branch) Codecov

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

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago