반응형
https://create-react-app.dev/docs/proxying-api-requests-in-development
npm install http-proxy-middleware --save
//setupProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({
target: process.env.REACT_APP_PROD_BASE_DOMAIN,
changeOrigin: true,
}),
);
app.use(
'/gw',
createProxyMiddleware({
target: process.env.REACT_APP_PROD_EGW_DOMAIN,
changeOrigin: true,
}),
);
};
반응형
'개발(라이브러리,프레임워크) > react.js & react native' 카테고리의 다른 글
ThemeProvider(styled-components) (0) | 2022.06.07 |
---|---|
memoization (0) | 2022.05.22 |
eject 대신 webpack설치하기 (0) | 2022.02.05 |
redux-promise-middleware (0) | 2022.02.04 |
redux-thunk (0) | 2022.02.03 |