Created
August 2, 2022 12:50
-
-
Save josefaidt/e44fe05fe34543b9eb19f05cc22a5d1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fn = new lambda.NodejsFunction(this, 'MyFunction', { | |
entry: fileURLToPath(new URL('./handler.ts', import.meta.url)), | |
functionName: `my-function`, | |
bundling: { | |
minify: true, // minify code, defaults to false | |
sourceMap: true, // include source map, defaults to false | |
sourceMapMode: lambda.SourceMapMode.INLINE, // defaults to SourceMapMode.DEFAULT | |
target: 'esnext', | |
define: { | |
'import.meta.vitest': 'undefined', | |
'process.env.NODE_ENV': JSON.stringify('production'), | |
}, | |
tsconfig: fileURLToPath(new URL('./tsconfig.json', import.meta.url)), | |
format: lambda.OutputFormat.ESM, | |
}, | |
runtime: Runtime.NODEJS_16_X, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda' | |
export const handler: APIGatewayProxyHandlerV2 = async (event) => { | |
console.log('EVENT:', JSON.stringify(event)) | |
return { | |
statusCode: 200, | |
body: JSON.stringify({ | |
message: 'Hello World', | |
}), | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"$schema": "https://json.schemastore.org/tsconfig", | |
"display": "Default", | |
"compilerOptions": { | |
"composite": false, | |
"declaration": true, | |
"declarationMap": true, | |
"esModuleInterop": true, | |
"forceConsistentCasingInFileNames": true, | |
"inlineSources": false, | |
"isolatedModules": true, | |
"module": "esnext", | |
"moduleResolution": "node", | |
"noUnusedLocals": false, | |
"noUnusedParameters": false, | |
"preserveWatchOutput": true, | |
"skipLibCheck": true, | |
"strict": true, | |
"target": "esnext", | |
"sourceMap": false, | |
"inlineSourceMap": true | |
}, | |
"exclude": ["node_modules"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment