[Angular] proxy 설정

Weirdo·2022년 9월 15일
0

middleware, 요청 링크 바꿔주는 듯..? 공부가 더 필요하다

Angular

proxy.conf.json 파일에 추가

{
  "/api": {
    "target": "http://localhost:3000",
    "secure": false,
    "changeOrigin": true,
    "pathRewrite": {
      "^/api": ""
    }
  }
}

angular.json에 추가

"proxyConfig": "proxy.conf.json"

또는 실행시 아래내용 추가

ng serve --proxy-config proxy.conf.json
profile
Yeah, weirdos change the world

0개의 댓글