Created
December 17, 2018 03:48
-
-
Save danemacaulay/5d2676bfb46ab6d08ce43e438ad0fa70 to your computer and use it in GitHub Desktop.
node proxy
This file contains 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 port = process.argv[2] || 7979 | |
const targetPort = process.argv[3] || 5000 | |
const path = process.argv[4] || 'client' | |
const express = require('express') | |
const proxy = require('http-proxy-middleware') | |
const app = express() | |
app.use(express.static(path)) | |
app.use('/services', proxy({target: `http://0.0.0.0:${targetPort}`, changeOrigin: true})) | |
app.listen(port, () => console.log(`Listening at http://localhost:${port}`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment