axios 통신을 맞추기 위해
<VSC>의 package.json에 "proxy":"http://localhost:8080"를 주어서 axios 통신할 때
js파일마다 localhost 주소를 써주지 않아도 되도록 만들었다. 또한, 백단과 통신을 맞추기 위해
<IntelliJ> 에서 application.properties 들어가면 server.port=8080으로 맞췄다.
웹URL의 localhost를 맞추기 위해
<VSC>의 package.json에 set port=80을
"scripts": {
"start": "set port=80 && react-scripts start",
~~~}
<IntelliJ> 에서 localhost:80으로 맞춰주면 된다.
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("http://localhost:80");
}
}
'사이드 프로젝트 > Spring Boot' 카테고리의 다른 글
[Spring] JDK 22.0.1 isn't compatible with Gradle 8.8. Please fix JAVA_HOME environment variable (0) | 2024.06.09 |
---|---|
[login] access Token 과 refresh Token 차이점 (0) | 2022.12.14 |
[devtools] - Intellij에 적용하는 방법 (0) | 2022.10.30 |
[스프링 부트 설치] - intellij와 연동 (0) | 2022.10.28 |