Last active
January 1, 2020 12:58
-
-
Save asamountain/6de6e5d3cb70bfab7feade2f588ecba6 to your computer and use it in GitHub Desktop.
When React proxy in package.json doesn't work, use 'http-proxy-middleware'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const proxy = require('http-proxy-middleware'); | |
module.exports = function (app) { | |
app.use(proxy('/search', {target: 'http://localhost:8000/'})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
src
folderproxy(
/targetUrl, {target:
http://localhost:port`})`