From b4dca2be0a786926893b1cfeb56226da816ddedc Mon Sep 17 00:00:00 2001 From: Sukhpreet Lohiya Date: Mon, 9 Feb 2026 06:36:52 +0000 Subject: [PATCH] code update recorded at: 09/02/26 06:36:52 --- handler.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 handler.js diff --git a/handler.js b/handler.js new file mode 100644 index 0000000..f242124 --- /dev/null +++ b/handler.js @@ -0,0 +1,22 @@ +// Define the handler function +export const handler = async (req, res) => { + try { + // Prepare the response JSON + const responseJson = { + message: "Hello World" + }; + + // 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'); + } +};