Skip to content

Instantly share code, notes, and snippets.

@dariye
Created September 7, 2018 15:02
Show Gist options
  • Save dariye/cf1c8ed2128df588d15be6574bd58cf6 to your computer and use it in GitHub Desktop.
Save dariye/cf1c8ed2128df588d15be6574bd58cf6 to your computer and use it in GitHub Desktop.
micro-proxy.js programmatic usage
const createProxy = require('micro-proxy')
const services = require('./services')
const {port} = require('./config').server
const server = createProxy(Object.values(services)
.map(service => service[process.env.NODE_ENV]))
server.listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
module.exports = server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment