New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cors-for-lambda

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

cors-for-lambda

Apply CORS Headers for Lambda HTTP responses

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

cors-for-lambda

"cors-for-lambda", is designed to apply CORS Headers for Lambda HTTP responses.

Getting Started

To get started with this project, clone the repository and install the necessary dependencies.

Usage

const cors = require("cors-for-lambda");

exports.handler = async (event) => {
  const response = {
    statusCode: 200,
    body: JSON.stringify("Hello from Lambda!"),
  };
  return cors.corsResponse(response, "*");
};

for multiples sites:

const cors = require("cors-for-lambda");

exports.handler = async (event) => {
  const response = {
    statusCode: 200,
    body: JSON.stringify("Hello from Lambda!"),
  };
  return cors.corsResponse(
    response,
    "https://example.com",
    "https://example2.com"
  );
};

Or

const { responseHeader } = require("cors-for-lambda");

exports.handler = async (event) => {
  const response = {
    statusCode: 200,
    headers: responseHeader("https://example.com", "https://example2.com"),
    body: JSON.stringify("Hello from Lambda!"),
  };
  return response;
};

Contributing

Contributions are welcome. Please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

FAQs

Package last updated on 01 Dec 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc