Skip to content

remix/routes · Class

View Source

Route

Summary

A route definition that includes a request method and pattern.

Signature

class Route<method, pattern> {
  constructor(
    method: method | 'ANY',
    pattern: pattern | RoutePattern<pattern>,
  ): Route<method, pattern>

  // Properties
  method: method | 'ANY'
  pattern: RoutePattern<pattern>

  // Methods
  href(args: CreateHrefArgs<pattern>): string
}

Properties

method

The HTTP method this route matches.

pattern

The parsed route-pattern AST. Useful for advanced consumers (e.g. matchers) that want to skip re-parsing the source string.

Methods

href(args: CreateHrefArgs<pattern>): string

Build a URL href for this route using the given route params and href options.

Parameters

args

Route params and href options