Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

restify-cors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify-cors

Common middlewares for all Node.js web services

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

restify-cors

CORS middleware with full W3C spec support.

NPM License

Build Status Dependencies Dev dependencies Peer dependencies

This project has been forked from https://github.com/TabDigital/restify-cors-middleware.

Changes

  • Supports restify 4.2
  • Usage with TypeScript

Usage

var restifyCors = require('restify-cors');

var cors = restifyCors({
  preflightMaxAge: 5, // Optional
  origins: ['http://api.myapp.com', 'http://web.myapp.com'], // defaults to ['*'] to allow all origins
  allowHeaders: ['API-Token'],
  exposeHeaders: ['API-Token-Expiry']
});

server.pre(cors.preflight);
server.use(cors.actual);

Compliance to the spec

See unit tests for examples of preflight and actual requests.

Keywords

restify

FAQs

Package last updated on 09 Nov 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