You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered: