Skip to content

Commit

Permalink
fix #1463 - grouped api routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed May 3, 2024
1 parent 3f02cbe commit 8dff006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/mighty-scissors-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

fix #1463 - grouped api routes
2 changes: 1 addition & 1 deletion packages/start/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down

0 comments on commit 8dff006

Please sign in to comment.