From d2af89252da83a68a4b7007819f7cbc68e35427d Mon Sep 17 00:00:00 2001 From: yerimming <120501910+yerimming@users.noreply.github.com> Date: Sun, 19 Jul 2026 15:28:08 +0900 Subject: [PATCH] feat(be): implement health check API --- .../com/example/coreTest/GeneratedCode.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/java/com/example/coreTest/GeneratedCode.java diff --git a/src/main/java/com/example/coreTest/GeneratedCode.java b/src/main/java/com/example/coreTest/GeneratedCode.java new file mode 100644 index 0000000..7d1f570 --- /dev/null +++ b/src/main/java/com/example/coreTest/GeneratedCode.java @@ -0,0 +1,38 @@ +package com.finvant.coretest.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.Instant; + +@RestController +@RequestMapping("/api/v1") +public class HealthController { + + @GetMapping("/health") + public ResponseEntity health() { + return ResponseEntity.ok( + new HealthResponse("OK", Instant.now().toEpochMilli()) + ); + } + + private static class HealthResponse { + private final String status; + private final long timestamp; + + public HealthResponse(String status, long timestamp) { + this.status = status; + this.timestamp = timestamp; + } + + public String getStatus() { + return status; + } + + public long getTimestamp() { + return timestamp; + } + } +}