Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Latest commit

 

History

History
13 lines (10 loc) · 400 Bytes

readme.markdown

File metadata and controls

13 lines (10 loc) · 400 Bytes

#proxy by url

this is a simple example of a node-http-middleware that will proxy based on the incoming url. say you want to proxy every request thing under /database to localhost:5984 (couchbd) (and remove the /database prefix)

this is how:

require('http-proxy').createServer(
  require('proxy-by-url')({
    '/database': { port: 5984, host: 'localhost' },
  })
).listen(8000)