Closed 0x80 closed 8 years ago
I am trying to use koa-proxy with koa v2. The
app.use(convert(proxy({host: ..., match: ...})) works fine
app.use(convert(proxy({host: ..., match: ...}))
Now I want to map one url to a specific proxy url. The docs talk about app.get() but since Koa 2 doesn't have an app.get() function anymore I figured I have to use koa-router...
Using koa-router@next, I've tried this:
router.get('/one', proxy({ host: 'http://localhost:7777', map: function(path) { return '/something/' + path } })) router.get('/two', proxy({url: 'http://localhost:7777'})) app .use(router.routes()) .use(router.allowedMethods())
Calling /one or /two is logged in my Koa server but nothing is passed to the proxy. What am I missing?
Ah damn it. I forgot to put a convert() around the proxy call.
I am trying to use koa-proxy with koa v2. The
app.use(convert(proxy({host: ..., match: ...}))
works fineNow I want to map one url to a specific proxy url. The docs talk about app.get() but since Koa 2 doesn't have an app.get() function anymore I figured I have to use koa-router...
Using koa-router@next, I've tried this:
Calling /one or /two is logged in my Koa server but nothing is passed to the proxy. What am I missing?