diff --git a/.changeset/mighty-scissors-shave.md b/.changeset/mighty-scissors-shave.md new file mode 100644 index 000000000..3b323d325 --- /dev/null +++ b/.changeset/mighty-scissors-shave.md @@ -0,0 +1,5 @@ +--- +"@solidjs/start": patch +--- + +fix #1463 - grouped api routes diff --git a/packages/start/src/router/routes.ts b/packages/start/src/router/routes.ts index 6fe66352e..290f84bf2 100644 --- a/packages/start/src/router/routes.ts +++ b/packages/start/src/router/routes.ts @@ -72,7 +72,7 @@ function containsHTTP(route: Route) { const router = createRouter({ routes: (fileRoutes as unknown as Route[]).reduce((memo, route) => { if (!containsHTTP(route)) return memo; - let path = route.path.replace(/\([^)/]+\)/g, "").replace(/\*([^/]*)/g, (_, m) => `**:${m}`); + let path = route.path.replace(/\/\([^)/]+\)/g, "").replace(/\([^)/]+\)/g, "").replace(/\*([^/]*)/g, (_, m) => `**:${m}`); if (/:[^/]*\?/g.test(path)) { throw new Error(`Optional parameters are not supported in API routes: ${path}`); }