From a81ada6ab85b1e7eb32feceb37f414bad4152764 Mon Sep 17 00:00:00 2001 From: Kamal Relwani Date: Wed, 6 Aug 2025 09:25:05 +0000 Subject: [PATCH] code update recorded at: 06/08/25 09:25:05 --- handler.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 handler.js diff --git a/handler.js b/handler.js new file mode 100644 index 0000000..c89e17f --- /dev/null +++ b/handler.js @@ -0,0 +1,25 @@ +// Define the handler function +export const handler = async (event, res) => { + try { + // Prepare the response JSON + const responseJson = { + message: "Listing all the products" + }; + + // 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'); + } +};