interface ISsrService
Since 0.1.0

Service contract for server-side rendering (SSR).

Registered by the React Router plugin under CAPABILITIES.SSR. The single render method receives the kernel's request context, delegates to the React Router request handler, and writes the resulting web Response back through IResponse (streaming or buffered).

Examples

Example 1

import { CAPABILITIES } from '@setu-ts/common';

const ssr = ctx.services.get<ISsrService>(CAPABILITIES.SSR);
const result = await ssr.render(ctx);
return result;

Methods

Since 0.1.0
render(ctx: IRequestContext): Promise<HandlerResult>

Renders an SSR document for the given request context.

Bridges the kernel IRequestContext into a web-standard Request, invokes the React Router request handler, maps the resulting web Response back onto ctx.response (status, headers, body), and returns the HandlerResult the route handler should return.

Usage

import { type ISsrService } from "common/src/index.ts";