Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TIPS & TRICK
- // how to match between client side route and server side route using MERN
- // change this code with your route app
- // add this for react < 16.20 or == 16.20 in package.json
- // or add this in your webpack config to webpack dev server, if your build react using manual
- "proxy": {
- "/auth/*" : {
- "target": "http://localhost:3001",
- "changeOrigin": true
- }
- }
- // before add this config install http-proxy-middleware , for react > 16.20 add this from your back-end server
- server.use(
- '/auth/*',
- createProxyMiddleware({
- target: 'http://localhost:3001',
- changeOrigin: true,
- xfwd: true
- })
- )
Add Comment
Please, Sign In to add comment