Closed legendtang closed 7 years ago
Because there is router.use('/', index.routes(), index.allowedMethods());
in app.js
.
When you write router.get('/test', ...)
, the router becomes //test
, so /test
got 404
.
You can change to router.get('test', ...)
.
@sinalvee Yes, I found out that Koa
routes behave differently comparing to Express
. I think the generated code is quite misleading. Root route is actually //
and user route is actually /user/
, which coincidentally behaves the same as /
and /user
. Your generator does confuse many newbies like me and even a Koa user.
So, would you like to improve your example code or just add some comment on it?
Do I made any mistakes? Thanks.