first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const NODEJS_STARTER_CODE = `exports.handler = async (event) => {
|
||||
return {
|
||||
statusCode: 200,
|
||||
body: JSON.stringify({
|
||||
message: 'Hello from Lambda!',
|
||||
event,
|
||||
}),
|
||||
};
|
||||
};`
|
||||
|
||||
const PYTHON_STARTER_CODE = `import json
|
||||
|
||||
|
||||
def handler(event, context):
|
||||
return {
|
||||
'statusCode': 200,
|
||||
'body': json.dumps({
|
||||
'message': 'Hello from Lambda!',
|
||||
'event': event,
|
||||
}),
|
||||
}`
|
||||
|
||||
export const lambdaStarterCodeByRuntime: Record<string, string> = {
|
||||
'nodejs22.x': NODEJS_STARTER_CODE,
|
||||
'nodejs20.x': NODEJS_STARTER_CODE,
|
||||
'nodejs18.x': NODEJS_STARTER_CODE,
|
||||
'python3.12': PYTHON_STARTER_CODE,
|
||||
'python3.11': PYTHON_STARTER_CODE,
|
||||
}
|
||||
|
||||
export function lambdaStarterCode(runtime: string): string {
|
||||
return lambdaStarterCodeByRuntime[runtime] ?? NODEJS_STARTER_CODE
|
||||
}
|
||||
Reference in New Issue
Block a user