Created
March 12, 2020 18:48
-
-
Save washingtonsoares/cf0920a026b4ac97f6a591663060923c to your computer and use it in GitHub Desktop.
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
var express = require('express'); | |
const proxy = require('http-proxy-middleware'); | |
var cors = require('cors') | |
var app = express(); | |
app.use(cors()) | |
app.use( | |
'/api', | |
proxy.createProxyMiddleware({ | |
target: 'https://your_URL.com', | |
changeOrigin: true, | |
pathRewrite: { '^/api': '' } | |
}) | |
); | |
app.listen(3002, function () { | |
console.log('Example app listening on port 3002!'); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment