routes

Each server-side routes object in an lwr.config.json file includes some of these properties

Properties 

PropertyTypeRequired/OptionalDescription
idStringRequiredThe unique identifier for the route.
pathStringRequiredThe unique URI path from which the route is served.
layoutTemplateStringOptionalThe path to a static template that renders the page layout. If you don’t set a value for layoutTemplate, it uses a default template.
contentTemplateFilepathSee descriptionEach route must have either a rootComponent or a contentTemplate, but not both. Set contentTemplate as the path to a static template that renders the page content.
rootComponentFilepathSee descriptionEach route must have either a rootComponent or a contentTemplate, but not both. Set rootComponent as the path to the top-level Lightning web component that LWR bootstraps into the HTML output for the route. If you use a rootComponent, LWR applies a default contentTemplate to render it.
propertiesJSON objectOptionalA JSON object that can be passed to the templates as context.
routeHandlerStringRequiredA path to a route handler function configured for the route.
cacheKey-value pairsOptionalThe cache settings for the routing, including:
bootstrapJSON objectOptionalThe bootstrap object contains client options that determine how an application page is loaded, including:
  • syntheticShadow: An optional boolean value. When true, LWC synthetic shadow is enabled. The default value is false.
  • services: An optional array of LWC modules to run on page load.
  • ssr: An optional boolean value. When true, server-side rendering is enabled for the route. The default value is false.
  • mixedMode: An optional boolean value. When true, mixed mode is enabled for the route. The default value is false.

Example 

Example route object
1{
2  "id": "example",
3  "path": "/",
4  "rootComponent": "example/app",
5  "layoutTemplate": "$layoutsDir/main.html",
6  "properties": { "staticParam": "This is the Home page" },
7  "cache": { "ttl": 60 }
8  "bootstrap": {
9      "syntheticShadow": true,
10      "services": ["example/service", "example/loaderHooks"]
11  }
12}

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!