Skip to content

Instantly share code, notes, and snippets.

@navarroaxel
Created February 5, 2020 20:15
Show Gist options
  • Save navarroaxel/6dfd07e99d3845e878f21e69767816a1 to your computer and use it in GitHub Desktop.
Save navarroaxel/6dfd07e99d3845e878f21e69767816a1 to your computer and use it in GitHub Desktop.
Prerender + proxy
const app = express()
app.use(require('prerender-node').set('prerenderServiceUrl', 'http://service.prerender.io'));
app.use(require('proxy'));
app.listen(3000);
var httpProxy = require('http-proxy');
module.exports = function (router) {
function callBackend(req, res) {
proxy.web(req, res, {
target: 'http://localhost:3030'
});
}
var proxy = httpProxy.createProxyServer({});
router.get('/', callBackend);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment