From f3e50078ad9404130a4056767104ec84729a84c2 Mon Sep 17 00:00:00 2001 From: Date: Mon, 4 May 2026 12:29:44 +0000 Subject: [PATCH] code update recorded at: 04/05/26 12:29:44 --- handler.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 handler.js diff --git a/handler.js b/handler.js new file mode 100644 index 0000000..ee4a8bc --- /dev/null +++ b/handler.js @@ -0,0 +1,29 @@ +// Define the handler function +export const handler = async (event, res) => { + try { + const a = 12; + const b = 12; + + // Prepare the response JSON + const responseJson = { + message: `Hello World ${a + b}` + }; + + // 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'); + } +};