Package Exports
- aws-lambda-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 (aws-lambda-cors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AWS Lambda CORS
CORS Library for AWS Lambda with APIGateway.
Installation
npm install aws-lambda-cors --saveUsage
import { cors } from 'aws-lambda-cors'
const originLambdaHandler = async (event, ctx) => {
return {
statusCode: 200,
body: '',
})
}
// Also OK.
//
// const originLambdaHandler = (event, ctx, callback) => {
// callback(null, {
// statusCode: 200,
// body: '',
// })
// }
export const lambdaHandler = cors({
allowCredentials: true,
allowOrigins: [
'http://localhost:8000',
'https://wani.kr',
],
allowMethods: [
'OPTIONS',
'HEAD',
'GET',
'POST',
],
allowHeaders: [
'Authorization',
'Content-Type',
],
allowCredentials: true,
})(originLambdaHandler)