RouterConfig

Pass a RouterConfig object to the createRouter() API to create a router for specific routes.

Properties 

PropertyTypeRequired/OptionalDescription
routesArrayOptionalAn array of route definitions. 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.
basePathStringOptionalA path prefix applied to all URIs for the router. If you don’t specify a base path, the default value is "".
caseSensitiveBooleanOptionalIf true, URIs are processed case sensitively. The default value is false.
i18nArrayOptionalAn i18n config that may affect the path prefix applied to all URIs. The default value is {locale: 'en-US', defaultLocale: 'en-US'}.

Syntax 

1type RouterConfig = {
2  routes?: RouteDefinition[],
3  basePath?: string,
4  caseSensitive?: boolean,
5  i18n?: {
6    locale: string;
7    defaultLocale: string;
8  },
9};

Example 

1routes: [
2    {
3      id: 'home',
4      uri: '/'
5      handler: () => import('example/homePageHandler'),
6        page: {
7            type: 'home',
8        },
9    },
10    {
11        id: 'namedPage',
12        uri: '/:pageName',
13        handler: () => import('example/namedPageHandler'),
14        page: {
15            type: 'namedPage',
16            attributes: {
17                pageName: ':pageName',
18            },
19        },
20    }
21  ],
22  basePath: '/my-site',
23  i18n: {
24    locale: 'es',
25    defaultLocale: 'en-US'
26  },
27  caseSensitive: true

Developer Preview Feature

Feature is available as a developer preview. Feature is not generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Do not implement functionality developed with these commands or tools.

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!