LwrRouterConfig

To configure a router module with the Router Module Provider, you have to set up both LwrRouterConfig and LwrConfigRouteDefinition.

Important

Syntax 

1interface LwrRouterConfig {
2    basePath?: string;
3    caseSensitive?: boolean;
4    routes: LwrConfigRouteDefinition[];
5    i18n?: I18NRouterConfig;
6}

Properties 

The LwrRouterConfig object, which is passed to the Router Module Provider, contains the same properties as RouterConfig, which is passed to createRouter().

PropertyTypeRequired/OptionalDescription
basePathStringOptionalA path prefix applied to all URIs for the router. If no base path is provided, the default value is empty (” ”).
caseSensitiveBooleanOptionalIf true, URIs are processed case sensitively. The default value is false.
routesArrayRequiredAn array of LwrConfigRouteDefinition objects.
i18nArrayOptionalAn i18n config that may affect the path prefix applied to all URIs. The default value is {locale: 'en-US', defaultLocale: 'en-US'}.

Example 

Static JSON Config File with LwrRouterConfig
1{
2    "caseSensitive": "true";        // URIs will be processed case sensitively
3    "i18n": {                       // Sets custom locale
4        "locale": "es",
5        "defaultLocale": "es-MX"
6    };
7    "routes": [                     // Defines routes for two pages: home and namedPage
8        {
9            "id": "home",
10            "uri": "/",
11            "component": "examples/home",
12            "page": {
13                "type": "home"
14            },
15            "metadata": {
16                "title": "Home"
17            }
18        },
19        {
20            "id": "namedPage",
21            "uri": "/:pageName",
22            "handler": "examples/namedPageHandler",
23            "page": {
24                "type": "namedPage",
25                "attributes": {
26                    "pageName": ":pageName"
27                }
28            }
29        }
30    ]
31}

See Also

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!