commit 9c0183849478f794859ac0d89fb4739db2301027 Author: Abhishek Test Tiwari Date: Fri Apr 17 09:33:57 2026 +0000 code update recorded at: 17/04/26 09:33:57 diff --git a/src/main/java/com/boltic/io/serverless/Handler.java b/src/main/java/com/boltic/io/serverless/Handler.java new file mode 100644 index 0000000..85919a1 --- /dev/null +++ b/src/main/java/com/boltic/io/serverless/Handler.java @@ -0,0 +1,32 @@ +package com.boltic.io.serverless; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +@Service +public class Handler { + + /** + * Handles the incoming request and returns a JSON response. + * + * @return ResponseEntity containing the JSON response or an error message. + */ + public ResponseEntity handler(String method, String requestBody) { + try { + // Prepare the response JSON + String responseJson = "{\"message\": \"Hello World\"}"; + + // Print the JSON response to stdout + System.out.println(responseJson); + + // Return the response with HTTP status 200 (OK) + return ResponseEntity.ok().body(responseJson); + } catch (Exception e) { + // Handle errors by printing the stack trace + e.printStackTrace(); + + // Return an error response with HTTP status 500 (Internal Server Error) + return ResponseEntity.status(500).body("Internal Server Error"); + } + } +}