npm install --save-dev http-proxy-middleware
백엔드와 프론트 앤드를 같은 도메인으로 운영하기 위해 사용
setupProxy.js
const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) {
app.use(
"/api",
createProxyMiddleware({
target: "http://localhost:3001",
changeOrigin: true,
})
);
};
'program > react' 카테고리의 다른 글
[react] react-helmet - header title 바꾸기 (0) | 2024.01.28 |
---|---|
[react] 환경세팅 , 프로젝트 생성, 빌드 하기 (0) | 2024.01.28 |