injectSSR

suspend fun BODY.injectSSR(handler: ElideController, request: HttpRequest<*>, domId: String = DEFAULT_SSR_DOM_ID, classes: Set<String> = emptySet(), attrs: List<Pair<String, String>> = emptyList(), path: String? = null, embeddedRoot: String? = null)

Evaluate and inject SSR content into a larger HTML page, using a <main> tag as the root element in the dom; apply domId, classes, and any additional attrs to the root element, if specified.

SSR script content will be loaded from the path node-prod.js within the embedded asset section of the JAR (located at /embedded at the time of this writing).

Parameters

domId

ID of the root element to express within the DOM. Defaults to root.

classes

List of classes to apply to the root DOM element. Defaults to an empty class list.

attrs

Set of additional attribute pairs to apply in the DOM to the root element. Defaults to an empty set.

path

Path within the embedded asset area of the JAR from which to load the SSR script. Defaults to node-prod.js, which is the default value used by the Node/Kotlin toolchain provided by Elide.

embeddedRoot

Resource folder path where embedded scripts are held. Defaults to embedded.