@gluonjs/ssr / packages/ssr/src / SsrRequestResult
Interface: SsrRequestResult
Properties
head
readonlyhead:string
html
readonlyhtml:string
router
readonlyrouter:RouterSnapshot
state
readonlystate:string
stateScript
readonlystateScript:string
store
readonlystore:StoreSnapshot
styles
readonlystyles:StyleManifest
Example
Consume the rendered body, safe state carrier, head resources, style manifest, and Router/Store snapshots produced before request cleanup:
import { createApp, html } from '@gluonjs/core';
import { renderRequest, type SsrRequestContext, type SsrRequestOptions, type SsrRequestResult } from '@gluonjs/ssr';
type ReportData = { title: string };
const options = {
url: '/reports/41',
routes: [{ path: '/reports/:id', name: 'report' }],
load: ({ router }: Omit<SsrRequestContext<ReportData>, 'data'>) => ({ title: `Report ${router.currentRoute.value.params.id}` }),
createApp: ({ data }) => createApp(() => html`<main>${data.title}</main>`),
} satisfies SsrRequestOptions<ReportData>;
const response: SsrRequestResult = await renderRequest(options);
console.log(response.html, response.stateScript);