개발 공부/Spring
[SpringBoot] REST API & IntelliJ 프로젝트생성
journey
2022. 2. 16. 00:26
728x90
02. Hello World API
1. REST Client 설치
chrome 설치
Talent API
- 구글 확장 프로그램으로 설치
https://chrome.google.com/webstore/detail/talend-api-tester-free-ed/aejoelaoggembcahagimdiliamlcdmfm?hl=en
Postman API
- 컴퓨터에 설치
https://www.postman.com/
2. 스프링부트 프로젝트 생성 (IntelliJ IDEA)
- New Module 생성
- Dependencies 추가
3. 스프링 부트 서버 실행
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController // 해당 class는 REST API 처리하는 Contorller
@RequestMapping("/api") // RequestMapping URI를 지정해주는 Annotation. 주소 할당
public class ApiController {
@GetMapping("/hello") // http://localhost:8080/api/hello
public String hello() {
return "hello spring boot!";
}
}