Koa multer can not work with koa-router
See original GitHub issueHi, this multer can not work with alexmingoia/koa-router (My koa is 1.x) My code is:
const uploader = require('koa-multer')({dest: path.join(__dirname, '../upload')}); const router = new (loadLib('koa-router'))(); router.post('/lo/banner/img', uploader.single('image'), function *() {...})
When upload a file, it will throw an Error below:
TypeError: next[(intermediate value)] is not a function at Object.allowedMethods (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:374:12) at next (native) at Object.allowedMethods (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:374:12) at next (native) at Object.dispatch (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-router/lib/router.js:336:14) at next (native) at Object.serve (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-static/index.js:43:14) at next (native) at Object.serve (/home/zsl/git/iooly/server/LockscreenManager/node_modules/koa-static/index.js:43:14) at next (native) at onFulfilled (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:65:19) at /home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:54:5 at Object.co (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:50:10) at Object.toPromise (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:118:63) at next (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:99:29) at onFulfilled (/home/zsl/git/iooly/server/LockscreenManager/node_modules/co/index.js:69:7)
So I make some changes with koa-multer and make it work with koa-router successful.The code I changed is: iooly/iooly-koa-multer.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
koa-router is the most popular router. This middleware must be able to support it
How’s this issues going?
koa-router
is still not supported yet? It would be better to put a notice on README file if it’s still unavailable