From d2701755c471f7dd373ffd444f548c5f73dc78bc Mon Sep 17 00:00:00 2001 From: m020202 Date: Sun, 18 Aug 2024 21:00:21 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=97=AC=EC=8A=A4=20=EC=B2=B4=ED=81=AC?= =?UTF-8?q?=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/locavel/config/SecurityConfig.java | 2 ++ .../web/controller/HealthCheckController.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/main/java/com/example/locavel/web/controller/HealthCheckController.java diff --git a/src/main/java/com/example/locavel/config/SecurityConfig.java b/src/main/java/com/example/locavel/config/SecurityConfig.java index a4652bc..96f2074 100644 --- a/src/main/java/com/example/locavel/config/SecurityConfig.java +++ b/src/main/java/com/example/locavel/config/SecurityConfig.java @@ -82,6 +82,8 @@ public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { .requestMatchers("/api/users/{user_id}/grade").permitAll() .requestMatchers("/api/users/{user_id}/grade").permitAll() .requestMatchers("/api/users/**").permitAll() + //TODO : 헬스체크용 api 허용 + .requestMatchers("/health").permitAll() .anyRequest().authenticated()) // 위의 경로 이외에는 모두 인증된 사용자만 접근 가능 .logout(logout -> logout .logoutUrl("/api/auth/logout") diff --git a/src/main/java/com/example/locavel/web/controller/HealthCheckController.java b/src/main/java/com/example/locavel/web/controller/HealthCheckController.java new file mode 100644 index 0000000..ec52d97 --- /dev/null +++ b/src/main/java/com/example/locavel/web/controller/HealthCheckController.java @@ -0,0 +1,13 @@ +package com.example.locavel.web.controller; + +import com.example.locavel.apiPayload.ApiResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HealthCheckController { + @GetMapping("/health") + public ApiResponse healthCheck() { + return ApiResponse.onSuccess("OK!!"); + } +}