Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
[NOISSUE] feat: index path 를 받는 컨트롤러를 구현한다
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDevLuffy committed May 19, 2020
1 parent 106ee8b commit 30eccd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public static <T> CoreApiResponse<T> success(T data) {
return new CoreApiResponse<>("200", "", data);
}

public static <T> CoreApiResponse<T> success(String message) {
return new CoreApiResponse<>("200", message, null);
}

public static <T> CoreApiResponse<T> fail(String code, String message) {
return new CoreApiResponse<>(code, message, null);
}
Expand Down
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 !");
}
}

0 comments on commit 30eccd0

Please sign in to comment.