---
url: /api/symbols/workbox-swkit/routing/route.md
---

# Route

Class @vite-pwa/workbox-swkit/routing

A `Route` consists of a pair of callback functions, "match" and "handler".
The "match" callback determine if a route should be used to "handle" a
request by returning a non-falsy value if it can. The "handler" callback
is called when there is a match and should return a Promise that resolves
to a `Response`.

## Constructor

```ts
new Route(match: RouteMatchCallback, handler: RouteHandler, method?: HTTPMethod)
```

Constructor for Route class.

**Parameters**

* `match` – A callback function that determines whether the route matches a given
  `fetch` event by returning a non-falsy value.

* `handler` – A callback
  function that returns a Promise resolving to a Response.

* `method` – The HTTP method to match the Route
  against.

## Properties

## Methods

### setCatchHandler()

```ts
setCatchHandler(handler: RouteHandler): void
```

**Parameters**

* `handler` – A callback
  function that returns a Promise resolving to a Response
