Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created March 12, 2020 18:48
Show Gist options
  • Save washingtonsoares/cf0920a026b4ac97f6a591663060923c to your computer and use it in GitHub Desktop.
Save washingtonsoares/cf0920a026b4ac97f6a591663060923c to your computer and use it in GitHub Desktop.
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