私のkoa@next
アプリは次の構造を持っています。私はkoa-router@next
ルーティングに使用しています:
./app.js
const Koa = require('koa');
const router = require('koa-router')();
const index = require('./routes/index');
const app = new Koa();
router.use('/', index.routes(), index.allowedMethods());
app
.use(router.routes())
.use(router.allowedMethods());
module.exports = app;
./routes/index.js
const router = require('koa-router')();
router.get('/', (ctx, next) => {
ctx.body = 'Frontpage';
});
router.get('/hello', (ctx, next) => {
ctx.body = 'Hello, World!';
});
module.exports = router;
ルートNot Found
でエラーが発生します。/hello
依存バージョン:
"dependencies": {
"koa": "^2.0.0-alpha.7",
"koa-router": "^7.0.1",
},
koa-router
v7.1.0でも同様です。
ご協力ありがとうございました!