Support different ways of mounting:
app.use(proxy('/api', {target:'http://www.example.org'}));
app.use(proxy('http://www.example.org/api')); // <-- shorthand
app.use('/api', proxy('http://www.example.org')); // <-- with optional path + shorthand
http://expressjs.com/4x/api.html#app.use
When optional path is configured, requests to /api/books/123 should be proxied to http://www.example.org/api/books/123
var proxy = require('http-proxy-middleware');
app.use('/api', proxy('http://www.example.org'));