Fix wrong router loop

This commit is contained in:
Alexandre Bodin 2021-08-31 10:46:50 +02:00
parent 7259bc54f6
commit 2013164680

View File

@ -47,12 +47,11 @@ module.exports = strapi => {
_.forEach(api.routes, route => {
// nested router
if (_.has(route, 'routes')) {
for (const key in api.routes) {
const routerInfo = api.routes[key];
for (const key in route.routes) {
const routerInfo = route.routes[key];
const router = new Router({ prefix: routerInfo.prefix });
// TODO:: support router routes
for (const route of routerInfo.routes || []) {
composeEndpoint(route, { apiName, router });
}