1.0.7 • Published 2 years ago
@heytrip/specify-lambda-common v1.0.7
Write your explicit Lambda function
// index.ts
import { specify, Get, Query, StatusCode, SnakeCase } from "specify-lambda"
@Get()
export class Request {
@Query("username")
username: string;
}
@StatusCode(200)
export class Response {
@SnakeCase()
readonly body: {
readonly message: string
}
}
export const handler = specify(
Request,
Response,
)(async ({ username }) => {
const message = `Hello ${username || "world"}!`
return {
body: { message },
}
})