Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/fetch-router/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is the changelog for [`fetch-router`](https://github.com/remix-run/remix/tr
- Export `InferRouteHandler` and `InferRequestHandler` types
- Re-export `FormDataParseError`, `FileUpload`, and `FileUploadHandler` from `@remix-run/form-data-parser`
- Fix an issue where per-route middleware was not being applied to a route handler nested inside a route map with its own middleware
- Adds functional aliases for routes that respond to a single HTTP verb
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this actually go under a new 0.7.0 heading?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHANGELOG is updated when a release is created, this if merged would not be part of an already released version


## v0.5.0 (2025-10-05)

Expand Down
11 changes: 11 additions & 0 deletions packages/fetch-router/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ export type {

export type { RouteHandlers, InferRouteHandler, RouteHandler } from './lib/route-handlers.ts'

export {
createDelete,
createDelete as delete, // shorthand
createGet,
createGet as get, // shorthand
createPost,
createPost as post, // shorthand
createPut,
createPut as put // shorthand
} from './lib/route-helpers.ts'

export {
Route,
createRoutes,
Expand Down
29 changes: 29 additions & 0 deletions packages/fetch-router/src/lib/route-helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { RoutePattern } from '@remix-run/route-pattern'

/**
* Shorthand for a DELETE route.
*/
export function createDelete<P extends string>(pattern: P | RoutePattern<P>) {
return { method: 'DELETE', pattern };
}

/**
* Shorthand for a GET route.
*/
export function createGet<P extends string>(pattern: P | RoutePattern<P>) {
return { method: 'GET', pattern };
}

/**
* Shorthand for a POST route.
*/
export function createPost<P extends string>(pattern: P | RoutePattern<P>) {
return { method: 'POST', pattern };
}

/**
* Shorthand for a PUT route.
*/
export function createPut<P extends string>(pattern: P | RoutePattern<P>) {
return { method: 'PUT', pattern };
}