Socket
Socket
Sign inDemoInstall

@dkx/http-middleware-cors

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dkx/http-middleware-cors

CORS middleware for @dkx/http-server


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
49.1 kB
Created
Weekly downloads
 

Readme

Source

DKX/Http/Middleware/Cors

CORS middleware for @dkx/http-server.

Installation

$ npm install --save @dkx/http-middleware-cors

or with yarn

$ yarn add @dkx/http-middleware-cors

Usage

const {Server} = require('@dkx/http-server');
const {corsMiddleware} = require('@dkx/http-middleware-cors');

const app = new Server;
const corsOptions = {
	domains: ['*']
};

app.use(corsMiddleware(corsOptions));

Options

  • domains:
    • Required
    • Array of allowed domains
    • If there is only one item and it is *, all incoming requests will be allowed
  • methods:
    • Optional
    • Array of allowed methods
    • Sets the access-control-allow-methods HTTP header
  • headers:
    • Optional
    • Array of allowed headers
    • Sets the access-control-allow-headers HTTP header
  • maxAge:
    • Optional
    • Number
    • Sets the access-control-max-age HTTP header
  • credentials:
    • Optional
    • Boolean
    • Sets the access-control-allow-credentials HTTP header

FAQs

Last updated on 18 Oct 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc