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

[BE] 전체 API Prefix 추가 #232

Merged
merged 2 commits into from
Aug 4, 2024
Merged

Conversation

kelly6bf
Copy link
Contributor

@kelly6bf kelly6bf commented Aug 4, 2024

연관된 이슈

구현한 기능

모든 API에 /api prefix 추가

상세 설명

배포 편의와 향후 API 버저닝을 염두하여 모든 API에 prefix를 추가햐였다.

@kelly6bf kelly6bf added the ⚙️ refactor 리팩터링 작업 label Aug 4, 2024
@kelly6bf kelly6bf self-assigned this Aug 4, 2024
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api")
Copy link
Member

@koust6u koust6u Aug 4, 2024

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 관리하면 훨씬 편리하지않을까요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오옷 좋은 거 같아요. 컨트롤러용 인터페이스를 뺴는게 나은가 생각했었는데

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이거 좋네요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 좋아보여요! 이미 머지를 해버려서.. 프람이 새로 구현해서 PR 올려 주시나요? 😎

@kelly6bf kelly6bf merged commit c7ac813 into BE/dev Aug 4, 2024
7 checks passed
@kelly6bf kelly6bf deleted the BE/feature/#231-api_prefix branch August 4, 2024 07:15
@kelly6bf kelly6bf restored the BE/feature/#231-api_prefix branch August 4, 2024 07:15
@kelly6bf kelly6bf deleted the BE/feature/#231-api_prefix branch August 4, 2024 07:15
@kelly6bf kelly6bf linked an issue Aug 4, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ refactor 리팩터링 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] 전체 API Prefix 추가
4 participants