Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertofrontado/d4c1c251e2414e791eb76fa83b6e87ff to your computer and use it in GitHub Desktop.
Save robertofrontado/d4c1c251e2414e791eb76fa83b6e87ff to your computer and use it in GitHub Desktop.
serverless-todo-gettodos-with-service
import 'source-map-support/register'
import { APIGatewayProxyHandler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import TodoService from '../../services/todoService'
export const handler: APIGatewayProxyHandler = async (_event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const todoService = new TodoService()
const items = await todoService.getAllTodos();
return {
statusCode: 201,
body: JSON.stringify({
items
})
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment