Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cors-express

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cors-express

Middleware to control CORS in an Express app

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-70.45%
Maintainers
1
Weekly downloads
 
Created
Source

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 = require('cors-express');

Initialization and Usage

var app = express(),
    options = {};

app.use(cors(options));

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 : null
},
max : {
    age : null
},
options : function(req, res, next){
    if (req.method == 'OPTIONS') {
        res.status(200).end();
    } else {
        next();
    }
},
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

Keywords

FAQs

Package last updated on 09 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc