File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ This is the changelog for [`fetch-router`](https://github.com/remix-run/remix/tr
3232- Export ` InferRouteHandler ` and ` InferRequestHandler ` types
3333- Re-export ` FormDataParseError ` , ` FileUpload ` , and ` FileUploadHandler ` from ` @remix-run/form-data-parser `
3434- Fix an issue where per-route middleware was not being applied to a route handler nested inside a route map with its own middleware
35+ - Adds functional aliases for routes that respond to a single HTTP verb
3536
3637## v0.5.0 (2025-10-05)
3738
Original file line number Diff line number Diff line change @@ -38,6 +38,17 @@ export type {
3838
3939export type { RouteHandlers , InferRouteHandler , RouteHandler } from './lib/route-handlers.ts'
4040
41+ export {
42+ createDelete ,
43+ createDelete as delete , // shorthand
44+ createGet ,
45+ createGet as get , // shorthand
46+ createPost ,
47+ createPost as post , // shorthand
48+ createPut ,
49+ createPut as put // shorthand
50+ } from './lib/route-helpers.ts'
51+
4152export {
4253 Route ,
4354 createRoutes ,
Original file line number Diff line number Diff line change 1+ import type { RoutePattern } from '@remix-run/route-pattern'
2+
3+ /**
4+ * Shorthand for a DELETE route.
5+ */
6+ export function createDelete < P extends string > ( pattern : P | RoutePattern < P > ) {
7+ return { method : 'DELETE' , pattern } ;
8+ }
9+
10+ /**
11+ * Shorthand for a GET route.
12+ */
13+ export function createGet < P extends string > ( pattern : P | RoutePattern < P > ) {
14+ return { method : 'GET' , pattern } ;
15+ }
16+
17+ /**
18+ * Shorthand for a POST route.
19+ */
20+ export function createPost < P extends string > ( pattern : P | RoutePattern < P > ) {
21+ return { method : 'POST' , pattern } ;
22+ }
23+
24+ /**
25+ * Shorthand for a PUT route.
26+ */
27+ export function createPut < P extends string > ( pattern : P | RoutePattern < P > ) {
28+ return { method : 'PUT' , pattern } ;
29+ }
You can’t perform that action at this time.
0 commit comments