-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BE] 전체 API Prefix 추가 #232
Conversation
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequestMapping("/api") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[의견]
@Component
public class WebConfig implements WebMvcConfigurer {
/**
* 경로 매칭 설정을 구성한다.
* "/user-service"로 시작하는 경로에 대해서만 @RestController 어노테이션이 적용된 컨트롤러에 매핑된다.
*
* @param configurer 경로 매칭 구성을 위한 PathMatchConfigurer 객체
*/
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.addPathPrefix("/user-service", HandlerTypePredicate.forAnnotation(RestController.class));
}
}
WebMvcConfigurer로 전역적인 api prefix 처리 방법이 있더군요! 이걸로 전역 prefix 관리하면 훨씬 편리하지않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오옷 좋은 거 같아요. 컨트롤러용 인터페이스를 뺴는게 나은가 생각했었는데
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이거 좋네요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 좋아보여요! 이미 머지를 해버려서.. 프람이 새로 구현해서 PR 올려 주시나요? 😎
연관된 이슈
구현한 기능
모든 API에
/api
prefix 추가상세 설명
배포 편의와 향후 API 버저닝을 염두하여 모든 API에 prefix를 추가햐였다.