0.0.9 • Published 4 years ago

middy-cors-extended v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

NPM version CircleCI Test Coverage Known Vulnerabilities

ATTENTION this package is not DEPRECATED as the extra CORS functionalities have been implemented in Middy

Middleware for Middy, extends the CORS middleware adding extra options.

Sets CORS headers (Access-Control-Allow-Origin, Access-Control-Allow-Headers and Access-Control-Allow-Credentials).

Sets headers in after and onError phases.

Options

  • origin (string) (optional): origin to put in the header (default: "*")
  • headers (string) (optional): comma list of headers to put in Access-Control-Allow-Headers (default: "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent")
  • credentials (boolean) (optional): if true, set Access-Control-Allow-Credentials to true, and put Access-Control-Allow-Origin as the Origin request header.

Sample usage

const middy = require('middy');
const { cors } = require('middy/middlewares');

const handler = middy((event, context, callback) => {
  callback(null, {});
});

handler.use(cors({ origin: 'http://www.google.co.uk', credentials: true }));
0.0.9

4 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago