---
# System prepended metadata

title: Router
tags: [brew-js]

---

---
tags: brew-js
---

# Router

```typescript
import brew from "brew-js/core";
import Router from "brew-js/extension/router";

brew.with(Router)(app => {
    app.useRouter({
        baseUrl: '/',
        routes: [
            '/{view}',
            '/'
        ]
    });
});
```

## Options

```typescript
interface RouterOptions {
    urlMode?: 'pathname' | 'query' | 'none';
    baseUrl?: string;
    explicitBaseUrl?: boolean;
    initialPath?: string;
    queryParam?: string;
    routes?: readonly string[];
}
```

### `routes`

See [Defining routes](/lzL52KxkTVup9Nexmf7rGw).

### `urlMode`

==Since `0.4.8`==

See [URL mode](/fdKwbbNxSIa3Ven3N5japA).

### `baseUrl`

See [URL mode](/fdKwbbNxSIa3Ven3N5japA).

### `explicitBaseUrl`

See [URL mode](/fdKwbbNxSIa3Ven3N5japA).

### `queryParam`

Specifies the query param to retrieve or set the app path.

### `initialPath`

