DevOpsAWSNode.js
Serverless with AWS Lambda and Node.js
Build and deploy serverless functions on AWS Lambda with Node.js, including cold start optimization tips.
Apr 8, 20268 min read9,400 views1100 words
Your First Lambda
TS
| 1 | import { APIGatewayProxyHandler } from 'aws-lambda'; |
| 2 | |
| 3 | export const handler: APIGatewayProxyHandler = async (event) => { |
| 4 | const { id } = event.pathParameters ?? {}; |
| 5 | const item = await getItem(id); |
| 6 | |
| 7 | return { |
| 8 | statusCode: 200, |
| 9 | headers: { 'Content-Type': 'application/json' }, |
| 10 | body: JSON.stringify(item), |
| 11 | }; |
| 12 | }; |