JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 198
  • Score
    100M100P100Q64412F
  • License MIT

Simple module to add Cross-Origin Resource Sharing headers to your routes

Package Exports

  • simple-cors

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-cors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#simple-cors

Simple module to add Cross-Origin Resource Sharing headers to your routes

This module will add the following (very open CORS headers) to your response.

Access-Control-Allow-Origin: '*'
Access-Control-Allow-Methods: 'GET,PUT,POST,DELETE,OPTIONS'
Access-Control-Allow-Headers: request.headers['access-control-request-headers']

and will respond with 200 OK to any OPTIONS request

#Install

npm install simple-cors

#Usage

var corsRoute = require('simple-cors');

routes['/api/test'] = corsRoute(function(request, response){
    response.end('Hello CORS World!');
});