-
-
Save ankeetmaini/ea0cb77e94ea77708d1786a064fb1d6b to your computer and use it in GitHub Desktop.
This file contains 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 httpProxy = require('http-proxy'); | |
const proxy = httpProxy.createProxyServer({ | |
target: 'http://proxy:8080' | |
}); | |
// catching the gRPC requests here | |
// and removing the made-up /api | |
// before sending it to proxy | |
app.all('/api/*', (req, res) => { | |
req.url = req.url.replace('/api', ''); | |
proxy.web(req, res, (e) => console.error(e)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment