- 주식 가격, 일자와 관련된 기록(설명)을 입력하고, 그래프로 보여주는 어플리케이션을 만들고 싶었다.
GET / charts 주식 차트 목록 조회
- None
- http code:
200 - content-type:
application/json;charset=UTF-8 - response:
[{"id":1,"title":"example1234","updateDateTime":"2024-09-19T23:46:25.303502"}]
GET / charts/download 주식 차트 샘플 다운로드
- None
- http code:
200 - content-type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - response: None
GET / charts/{chartId}/download 주식 차트 다운로드
- chartId (Long)
- http code:
200 - content-type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - response: None
POST / charts/upload 주식 차트 엑셀파일 등록
- title (String)
- file (MultipartFile)
- http code:
200 - content-type: None
- response: None
POST / charts/{chartId}/upload 주식 차트 엑셀파일 재등록
- chartId (Long)
- title (String)
- file (MultipartFile)
- http code:
200 - content-type: None
- response: None
GET / charts/{chartId}/day 일간 차트 조회
- chartId (Long)
-
http code:
200 -
content-type:
application/json -
response :
[ { "date": "2024-01-01", "price": 20000.0, "description": "Sample day record" }, { "date": "2024-01-02", "price": 10000.0, "description": "Sample day record" }, { "date": "2024-01-03", "price": 22348.0, "description": "Sample day record" } ]
GET / charts/{chartId}/day 일간 차트 조회
- chartId (Long)
-
http code:
200 -
content-type:
application/json -
response :
[ { "date": "2024-01-01", "price": 20000.0, "description": "Sample day record" }, { "date": "2024-01-02", "price": 10000.0, "description": "Sample day record" }, { "date": "2024-01-03", "price": 22348.0, "description": "Sample day record" } ]
GET / charts/{chartId}/week 주간 차트 조회
- chartId (Long)
- http code:
200 - content-type:
application/json - response :
[ { "date": "2024-01-01", "price": 20000.0, "description": "Sample week record" }, { "date": "2024-01-08", "price": 10000.0, "description": "Sample week record" }, { "date": "2024-01-15", "price": 22348.0, "description": "Sample week record" } ]
GET / charts/{chartId}/month 월간 차트 조회
- chartId (Long)
- http code:
200 - content-type:
application/json - response :
[ { "date": "2024-01-01", "price": 20000.0, "description": "Sample month record" }, { "date": "2024-02-01", "price": 10000.0, "description": "Sample month record" }, { "date": "2024-03-01", "price": 22348.0, "description": "Sample month record" } ]
프론트엔드 서버와 백엔드 서버를 따로 구성하면, 백엔드 서버에서 다른 주소의 요청을 받을 수 있도록 설정해야 한다.
같은 출처(주소)가 같은 곳에 대한 요청만 허용하는 것이 기본 설정이기 때문이다.
스프링 웹 서블릿에서는 CorsResitory로 설정할 수 있다.
@Configuration
class WebMnbConfig : WebMvcConfigurer {
override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
super.addCorsMappings(registry)
}
}Flutter(Dart)
JPA, Kotiln, H2 Database, SpringBoot, Gradle



