Skip to content

Instantly share code, notes, and snippets.

@rjcorwin
Created February 7, 2014 17:09
Show Gist options
  • Select an option

  • Save rjcorwin/8867155 to your computer and use it in GitHub Desktop.

Select an option

Save rjcorwin/8867155 to your computer and use it in GitHub Desktop.
Combine the CouchDB API with another HTTP API using Node.js http-proxy module.
var httpProxy = require('http-proxy')
var options = {
router: {
'mydomain.com/api': '127.0.0.1:8800', // -> Additional API possibly from an Express App
'mydomain.com/*': '127.0.0.1:5984', // -> CouchDB binded to the base so it behaves just like a CouchDB
}
}
httpProxy.createServer(options).listen(80)
console.log('httpProxy listening at port 80')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment