• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

Proxy error: Could not proxy request /api/productList from localhost:8080 to http://127.0.0.1:3000. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).

21.09.13 22:16 작성 조회수 620

0

몇일째 이걸로 잡혀있어요 ㅠㅜㅠ
외부 호스트에서 접근 해서 그렇다는데 ㅠㅜㅠㅜ
Proxy error: Could not proxy request /api/productList from localhost:8080 to http://127.0.0.1:3000. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
 
 
개발자 모드에서는
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
    at _callee$ (mixins.js?9c9e:8)
    at tryCatch (runtime.js?96cf:63)
    at Generator.invoke [as _invoke] (runtime.js?96cf:294)
    at Generator.eval [as next] (runtime.js?96cf:119)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
  at _next (asyncToGenerator.js?1da1:25)
 
이라고 뜨는데 아마 서버에서 값을 못가져 오는 거 같은데 ㅠㅜㅠㅜ
선생님 너무 답답해여 ㅠ

답변 2

·

답변을 작성해보세요.

0

front님의 프로필

front

질문자

2021.09.14

이미 적혀 져 있습니다 ㅠㅜㅠ

0

vue.config.js 파일 프로젝트 루트 폴더에 만들고 아래 코드 넣으세요. 그리고 서버 재시작

 

 const target = 'http://127.0.0.1:3000';

 module.exports = {

 devServer: {

    port: 8080,

    proxy: {

      '^/api': {

        target,

        changeOrigin: true

      },

       '^/upload': {

        target,

         changeOrigin: true,

       },

      '^/download': {

        target,

        changeOrigin: true,

      }     

}

   }

 }