[Practice] 공지사항 게시판 목록에 대한 요청 API 만들기 (1)
2021. 4. 12. 13:59ㆍSpring/Practice
1. 문제
- REST API 형식으로 구현
- HTTP METHOD는 GET
- 요청 주소는 "/api/notice"
- 리턴값은 문자열 "공지사항입니다." 리턴
2. 풀이
package com.example.jpa.sample.notice;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ApiNoticeController {
// 문제 6
@GetMapping("/api/notice")
public String noticeString() {
return "공지사항입니다.";
}
}
728x90
'Spring > Practice' 카테고리의 다른 글
[Practice] 공지사항 게시판 목록에 대한 요청 API 만들기 (3) (0) | 2021.04.12 |
---|---|
[Practice] 공지사항 게시판 목록에 대한 요청 API 만들기 (2) (0) | 2021.04.12 |
[Practice] 클라이언트 요청에 대한 주소 만들기 (5) (0) | 2021.04.12 |
[Practice] 클라이언트 요청에 대한 주소 만들기 (4) (0) | 2021.04.12 |