Closed TrejoCode closed 4 years ago
Works, using:
route.use('/:id', levelsRoutes.routes());
Example:
const levels = require('./levels');
const route = new koaRouter({
prefix: '/courses'
});
route.get('/', koaBody(), async (context) => {
// Some Logic
context.body = { "Courses": "All" };
});
route.get('/:id', koaBody(), async (context) => {
// Some Logic
context.body = { "Course": "1" };
});
// Endpoint for /levels
route.use('/:id', levelsRoutes.routes());
Thank you, seems strange because i need 'repeat' the same route.
Hi, have a problem with the routes, it is the following:
All courses: Works
Specific course: Works
Specific course with Nested Routes: Doesn't work - 404
courses.js
levels.js
Can anybody help me?