Created
February 5, 2020 20:15
-
-
Save navarroaxel/6dfd07e99d3845e878f21e69767816a1 to your computer and use it in GitHub Desktop.
Prerender + proxy
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 app = express() | |
app.use(require('prerender-node').set('prerenderServiceUrl', 'http://service.prerender.io')); | |
app.use(require('proxy')); | |
app.listen(3000); |
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 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