🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cors-expressjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cors-expressjs

Cors middleware for Express framework

0.1.2
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

cors-expressjs

Cors middleware for Express framework

Build Status Coverage Status

Class based middleware for CORS support for APIs. Based on article HTTP access control (CORS)

Installation

Install Cors as an npm module and save it to your package.json file as a dependency:

npm install --save cors-expressjs

Basic Usage

To start using this middleware you need to create an instance of Cors class. Then you can use middleWare method. Here is example:

    'use strict';
    const express = require('express');
    const Cors = require('cors-expressjs');
    const app = express();
    const cors = new Cors();

    app.use(cors.middleWare());
    app.get('/', (req, res) => res.json({ success: true }));

    app.listen(3000);

That's it. Very simple :)

Tests

npm test

Keywords

cors

FAQs

Package last updated on 14 Aug 2017

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