diff --git a/lib/routes.js b/lib/routes.js index aec5426..aa5bd51 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -11,7 +11,7 @@ function excludeRoutes(patterns, routes) { patterns.forEach(pattern => { const minimatch = new Minimatch(pattern) minimatch.negate = true - routes = routes.filter(route => minimatch.match(route)) + routes = routes.filter(route => minimatch.match(route.url)) }) return routes } @@ -24,7 +24,7 @@ function excludeRoutes(patterns, routes) { */ function getStaticRoutes(router) { // Get all static routes and ignore dynamic routes - return flattenRoutes(router).filter(route => !route.includes(':') && !route.includes('*')) + return flattenRoutes(router).filter(route => !route.url.includes(':') && !route.url.includes('*')) } /** @@ -41,7 +41,10 @@ function flattenRoutes(router, path = '', routes = []) { flattenRoutes(route.children, path + route.path + '/', routes) } if (route.path !== '') { - routes.push(path + route.path) + routes.push({ + ...route, + url: path + route.path + }) } }) return routes