---
# System prepended metadata

title: '`Route` object'
tags: [brew-js]

---

---
tags: brew-js
---

# `Route` object

## Properties

### `Route[key]`

Gets and sets the route parameter.

The available keys depends on the routes given when initializing the router.

```typescript!
app.useRouter({
    routes: [
        '/{view:user}/{id}'
        '/{view}',
        '/'
    ]
});

Object.keys(app.routes); // ['view', 'id', 'remainingSegments']
```

### `Route.remainingSegments`

Gets or sets the path matched by the ending wildcard (`*`).

## Methods

### `Route.parse`

Parses a given string and returns route parameters if any route matches the path.

### `Route.set`

Sets multiple parameters at once, such that the app will navigate to the final path represented by the updated parameters.

### `Route.replace`

Updates router and cause the app to redirect to the specified path. Visit of current page in the history stack will be replaced.

### `Route.getPath`

Gets the path represented by specified route parameters.
If none of the routes matches, the root path `/` is returned.

### `Route.toJSON`

Gets all route parameters as a plain JSON object.

### `Route.toString`

Gets the current path.

