commit 049e424d85ff3f50cd275c497f6ab06b27ab19f7 Author: Aayush Jain Date: Thu May 15 08:49:00 2025 +0000 code update recorded at: 15/05/25 08:49:00 diff --git a/handler.js b/handler.js new file mode 100644 index 0000000..f87cf23 --- /dev/null +++ b/handler.js @@ -0,0 +1,26 @@ +// Define the handler function +export const handler = async (event, res) => { + try { + // Prepare the response JSON + const responseJson = { + message: "Hello World", + event + }; + + // Print the JSON response to stdout + console.log(JSON.stringify(responseJson)); + + // Set the response headers + res.setHeader('Content-Type', 'application/json'); + + // Send the response JSON + res.end(JSON.stringify(responseJson)); + } catch (error) { + // Handle errors + console.error(error); + // Send an error response if needed + res.statusCode = 500; + res.setHeader('Content-Type', 'text/plain'); + res.end('Internal Server Error'); + } +};