---
title: RouteBuilder
source: https://github.com/remix-run/remix/blob/main/packages/fetch-router/src/lib/router.ts#L122
---

# RouteBuilder

## Summary

A route builder registers routes into a router.

Route builders are useful for composing route groups with [`RouteInstaller`](/api/remix/router/interface/RouteInstaller/). Unlike a
[`Router`](/api/remix/router/interface/Router/), a route builder cannot dispatch requests.

## Signature

```ts
interface RouteBuilder<context> {
  [routeBuilderContext]?: context
  delete: VerbMethod<'DELETE', context>
  get: VerbMethod<'GET', context>
  head: VerbMethod<'HEAD', context>
  options: VerbMethod<'OPTIONS', context>
  patch: VerbMethod<'PATCH', context>
  post: VerbMethod<'POST', context>
  put: VerbMethod<'PUT', context>
  map<
    target extends MapTarget,
    handlerContext extends AnyContext,
    middleware extends readonly AnyMiddleware[],
  >(
    target: target,
    handler: MapHandler<target, handlerContext, middleware> &
      ContextCompatibility<context, handlerContext, middleware>,
  ): void
  mount<pattern extends string>(
    prefix: pattern | RoutePattern<pattern>,
    installer: RouteInstaller<ContextWithParams<context, MatchParams<pattern>>>,
  ): void
  route<
    method extends RequestMethod | 'ANY',
    pattern extends string,
    actionContext extends AnyContext,
    middleware extends readonly AnyMiddleware[],
  >(
    method: method,
    pattern: RouteTarget<pattern, method>,
    action: Action<RouteTarget<pattern, method>, actionContext, middleware> &
      ContextCompatibility<context, actionContext, middleware>,
  ): void
}

```

## Properties

### `[routeBuilderContext]`

### `delete`

Shorthand for registering a `DELETE` route.

### `get`

Shorthand for registering a `GET` route.

### `head`

Shorthand for registering a `HEAD` route.

### `options`

Shorthand for registering an `OPTIONS` route.

### `patch`

Shorthand for registering a `PATCH` route.

### `post`

Shorthand for registering a `POST` route.

### `put`

Shorthand for registering a `PUT` route.

## Methods

### `map<target extends MapTarget, handlerContext extends AnyContext, middleware extends readonly AnyMiddleware[]>(target: target, handler: MapHandler<target, handlerContext, middleware> & ContextCompatibility<context, handlerContext, middleware>): void`

Maps either a single route target to an action or a route map to a controller.



### `mount<pattern extends string>(prefix: pattern | RoutePattern<pattern>, installer: RouteInstaller<ContextWithParams<context, MatchParams<pattern>>>): void`

Mounts a route installer at a route pattern prefix.



### `route<method extends RequestMethod | "ANY", pattern extends string, actionContext extends AnyContext, middleware extends readonly AnyMiddleware[]>(method: method, pattern: RouteTarget<pattern, method>, action: Action<RouteTarget<pattern, method>, actionContext, middleware> & ContextCompatibility<context, actionContext, middleware>): void`

Registers a handler for a specific request method and route target.

Accepts either a plain request handler or an action object with optional action middleware.

