Skip to content

Instantly share code, notes, and snippets.

const handler = async () => ({
statusCode: 200,
body: JSON.stringify({ fruits: ['What a great tomato'] }),
headers: { 'Content-Type': 'application/json' },
});
import middy from '@middy/core';
// Business logic
const businessLogic = async (event) => {
...
return myResponse;
};
// Configuration
export const myHandler = middy(businessLogic).onError(handleError);