An open API service indexing awesome lists of open source software.

https://github.com/bpcloud/middleware-koa-cors

koa CORS middleware in bpframework
https://github.com/bpcloud/middleware-koa-cors

Last synced: about 1 month ago
JSON representation

koa CORS middleware in bpframework

Awesome Lists containing this project

README

        

# koa CORS middleware in bpframework.

### Middleware specification

https://github.com/bpcloud/middleware

### usage

Setup.

```js
import { Application } from 'bpframework';
import * as middleware_cors from '@bpframework/middleware-koa-cors';

// set CORS by default.
Application.use(middleware_cors.middleware({
allowOrigin: '*',
withCredentials: true,
allowHeaders: ['X-Custom-Headers'],
exposeHeaders: ['X-Custom-Headers'],
}));
Application.runKoa(...);

// enable or disable.
middleware_cors.setEnable(false);
```