---
schema_version: "1"
id: f5f240a28124f91ba1b6cca1e9c9d7e881977bd3dff6fcc73625c6d0a7ae482b
title: RouterConfig
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lwr-node/lwr/references/csr-reference/routerconfig.md
canonical_url: https://developer.salesforce.com/docs/platform/lwr/references/csr-reference/routerconfig.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a043672ea51789cc26df4bb2aba53ffa8ffaea884116466a4a903bba9135b27f
products:
  - Lightning Web Runtime
---
# RouterConfig

Pass a `RouterConfig` object to the [`createRouter()`](https://developer.salesforce.com/docs/platform/lwr/references/csr-reference/createrouter.md) API to create a router for specific routes.

## Properties

| Property        | Type    | Required/Optional | Description                                                                                                                                                                                                                             |
| --------------- | ------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `routes`        | Array   | Optional          | An array of [route definitions](https://developer.salesforce.com/docs/platform/lwr/references/csr-reference/routedefinition.md). If you don't specify a `RouteDefinition` array, the default value is an empty array. If you don't specify a value for `RouterConfig.routes`, the router can't match any locations. |
| `basePath`      | String  | Optional          | A path prefix applied to all URIs for the router. If you don't specify a base path, the default value is `""`.                                                                                                                          |
| `caseSensitive` | Boolean | Optional          | If `true`, URIs are processed case sensitively. The default value is `false`.                                                                                                                                                           |
| `i18n`          | Array   | Optional          | An [`i18n`](https://developer.salesforce.com/docs/platform/lwc/guide/create-i18n.html) config that may affect the path prefix applied to all URIs. The default value is `{locale: 'en-US', defaultLocale: 'en-US'}`.                    |

## Syntax

```
type RouterConfig = {
  routes?: RouteDefinition[],
  basePath?: string,
  caseSensitive?: boolean,
  i18n?: {
    locale: string;
    defaultLocale: string;
  },
};
```

## Example

```
routes: [
    {
      id: 'home',
      uri: '/'
      handler: () => import('example/homePageHandler'),
        page: {
            type: 'home',
        },
    },
    {
        id: 'namedPage',
        uri: '/:pageName',
        handler: () => import('example/namedPageHandler'),
        page: {
            type: 'namedPage',
            attributes: {
                pageName: ':pageName',
            },
        },
    }
  ],
  basePath: '/my-site',
  i18n: {
    locale: 'es',
    defaultLocale: 'en-US'
  },
  caseSensitive: true
```
