cors-express
Middleware to control CORS in an Express app
Installation
The best way to install it is using npm
npm install cors-express --save
Loading
var cors = ;
Initialization and Usage
var app = options = {}; app;
Options
allow : origin: '*' methods: 'GET,PATCH,PUT,POST,DELETE,HEAD,OPTIONS' headers: 'Content-Type, Authorization, Content-Length, X-Requested-With, X-HTTP-Method-Override'expose : headers : nullmax : age : null{ if reqmethod == 'OPTIONS' resstatus200; else ; }specials : powered : null
Options
This method override the normal use of the "option" method and return OK with seted CORS headers
Specials
Powered
Can change the "x-powered-by" header. You can use:
- null show original header: "Express"
- false doesn't show the header: "Express
- string show your own string
Support
This plugin is proudly supported by Kubide hi@kubide.es