diff --git a/index.js b/index.js index 03b05fd..02704c4 100644 --- a/index.js +++ b/index.js @@ -795,10 +795,13 @@ app.all("*", async (req, res) => { try { let routeMatch = null; + // routes[verb] is ordered most-recently-updated first (getAllRoutes sorts + // by updated_at DESC), so the first match is the most recently saved route. for (let { matcher, id } of routes[verb]) { let matchFromRoute = matcher(req_path); if (matchFromRoute) { routeMatch = { params: matchFromRoute.params, id: id }; + break; } }