λ Unofficial AWS Lambda type definition
import type { LambdaHandler } from '@jill64/types-lambda'
export const handler: LambdaHandler = async (event) => {
// ...
return {
statusCode: 200,
body: 'Hello from Lambda !'
}
}
import { awslambda } from '@jill64/types-lambda'
export const handler = awslambda.streamifyResponse(
async (event, responseStream, _context) => {
// ...
const metadata = {
statusCode: 200,
headers: {
'Content-Type': 'application/json'
}
}
responseStream = awslambda.HttpResponseStream.from(responseStream, metadata)
responseStream.write('Streaming with Helper \n')
responseStream.write('Hello 0 \n')
responseStream.write('Hello 1 \n')
responseStream.write('Hello 2 \n')
responseStream.end()
await responseStream.finished()
}
)
import type { OriginRequestHandler } from '@jill64/types-lambda'
export const handler: OriginRequestHandler = async (event, context) => {
// ...
return {
status: '200'
}
}