Skip to content

Commit d0d17ff

Browse files
committed
Add readme
1 parent ff991d0 commit d0d17ff

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
11
# node-microframework-cors
22
Plugin to activate cors support
3+
4+
## Installing
5+
6+
To install and add the dependency to the package.json, run the following command:
7+
8+
```
9+
npm install bap-node-microframework-cors --save
10+
```
11+
12+
## Configuration
13+
14+
To activate cors support with the default options (enable All CORS Requests), write the following code in app/app.ts:
15+
16+
```javascript
17+
// app/app.ts
18+
...
19+
20+
import { CorsPlugin } from 'bap-node-microframework-cors';
21+
22+
...
23+
24+
import { Kernel } from "./kernel";
25+
var kernel = new Kernel();
26+
var App = new Application(<ApplicationOptions>{
27+
...
28+
}, <KernelInterface>kernel);
29+
30+
...
31+
32+
App.registerPlugin(CorsPlugin, {});
33+
34+
...
35+
36+
App.start();
37+
38+
...
39+
```
40+
41+
You can read the full list of configuration options (here)[https://github.com/expressjs/cors#configuration-options] (at the moment, only origin and credentials are supported).

0 commit comments

Comments
 (0)