Skip to content

Instantly share code, notes, and snippets.

@danemacaulay
Created December 17, 2018 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danemacaulay/5d2676bfb46ab6d08ce43e438ad0fa70 to your computer and use it in GitHub Desktop.
Save danemacaulay/5d2676bfb46ab6d08ce43e438ad0fa70 to your computer and use it in GitHub Desktop.
node proxy
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