Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor : health-check api 수정 #123

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/dbdr/global/configuration/HealthcheckController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dbdr.global.configuration;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthcheckController {
@GetMapping(value = "/health")
public ResponseEntity<?> healthcheck() {
return ResponseEntity.ok()
.body("OK");
}
}
3 changes: 1 addition & 2 deletions src/main/java/dbdr/global/configuration/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 모든 경로에 대해 CORS 허용
.allowedOriginPatterns("*") // allowCredentials 사용 시 '*' 대신 allowedOriginPatterns 사용
.allowedOriginPatterns("*") // “*“같은 와일드카드를 사용
.allowedMethods("GET", "POST", "PUT", "DELETE") // 허용할 HTTP 메서드 지정
.allowedHeaders("*") // 모든 헤더 허용
.allowCredentials(true); // 인증 정보 허용
}
}