This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NOISSUE] feat: index path 를 받는 컨트롤러를 구현한다
- Loading branch information
1 parent
106ee8b
commit 30eccd0
Showing
2 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 11 additions & 4 deletions
15
tecobrary-core-api/src/main/java/com/woowacourse/tecobrary/web/HomeController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
package com.woowacourse.tecobrary.web; | ||
|
||
import com.woowacourse.tecobrary.common.dto.CoreApiResponse; | ||
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 org.springframework.web.servlet.view.RedirectView; | ||
|
||
@RestController | ||
@RequestMapping("/api/v2") | ||
@RequestMapping | ||
public class HomeController { | ||
|
||
@GetMapping | ||
public ResponseEntity index() { | ||
return ResponseEntity.ok("Hello. This is Tecobrary API v2. Welcome !"); | ||
@GetMapping("/") | ||
public RedirectView redirect() { | ||
return new RedirectView("/api/v2"); | ||
} | ||
|
||
@GetMapping("/api/v2") | ||
public CoreApiResponse index() { | ||
return CoreApiResponse.success("Hello. This is Tecobrary API v2. Welcome !"); | ||
} | ||
} |