Created
March 23, 2020 13:35
-
-
Save configurator/c8e368926aa4abd7d0317fa1c53ba597 to your computer and use it in GitHub Desktop.
A basic reverse proxy in node.js
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
// This reverse proxy is for local development only | |
const express = require("express"); | |
const proxy = require("express-http-proxy"); | |
const app = express(); | |
const proxyPort = 8000; | |
const webpackPort = 8080; | |
app.use("/", proxy(`http://localhost:${webpackPort}`)); | |
app.listen(proxyPort, () => | |
console.log( | |
`Proxying http://localhost:${proxyPort}/ => http://localhost:${webpackPort}/` | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment