You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`/docs/[...path].ts`|`/docs/:path+`|`GET /docs/foo` with `{ path: "foo" }` <br> `GET /docs/a/b/c` with `{ path: "a/b/c" }`|`GET /docs`|
94
+
|`/docs/[...path]+get.ts`|`/docs/:path+`|`GET /docs/foo` with `{ path: "foo" }` <br> `GET /docs/a/b/c` with `{ path: "a/b/c" }`|`GET /docs`|
94
95
95
96
#### Optional catch-all parameters
96
97
97
98
Route parameter names as `[[...name]]` consumes all remaining path segments, but also matches routes with no segments. This route can only be used in a file name.
98
99
99
100
| File name | Route pattern | Matched requests |
100
101
| - | - | - |
101
-
|`/docs/[[...path]].ts`|`/docs/:path+`|`GET /docs` with `{}` <br> `GET /docs/foo` with `{ path: "foo" }` <br> `GET /docs/a/b/c` with `{ path: "a/b/c" }`|
102
+
|`/docs/[[...path]]+get.ts`|`/docs/:path+`|`GET /docs` with `{}` <br> `GET /docs/foo` with `{ path: "foo" }` <br> `GET /docs/a/b/c` with `{ path: "a/b/c" }`|
102
103
103
104
#### HTTP methods
104
105
105
-
Add HTTP method before an extension to make route match only given HTTP method. By default, route will serve any incoming HTTP method.
106
+
Add HTTP method before an extension to make route match only given HTTP method. If no method is specified, the route will match special `UNDEF` method which is used by drivers that do not rely on HTTP stack such as WebSockets or [Tasq](https://github.com/kirick-ts/tasq).
But you can not use HTTP method in the filename if there is no name for the route. If you want to serve `POST /account`, create file `/account.post.ts` or `account/index.post.ts`, not just `account/post.ts`.
112
114
@@ -131,7 +133,7 @@ console.log('API server running on http://localhost:3000');
131
133
132
134
### 3. Create your API handlers
133
135
134
-
Example of a basic endpoint (`hyper-api/hello.get.ts`):
136
+
Example of a basic endpoint (`hyper-api/hello+get.ts`):
0 commit comments