| title | createHandler |
|---|
The createHandler is used to start the server in entry-server.tsx.
It takes a function that returns a static document (often created with <StartServer>), renders, and serves it.
:::note To fully understand how to leverage different rendering modes, please refer to the Rendering Modes page. :::
A createHandler is essential to every SolidStart app.
To fallback the rendering mode to the app.config.ts definition (or the default "stream" mode), you can use the createHandler without any options.
import { createHandler, StartServer } from "@solidjs/start/server";
export default createHandler(() => (
<StartServer document={...}
/>
));It is also possible to override the rendering mode for a specific route.
type RenderingModes = "stream" | "async" | "sync";
function createHandler(
handler: () => (document: any, options?: any) => void,
options?:
| { mode?: RenderingModes }
| ((event: RequestEvent) => { mode: RenderingModes })
| undefined
): (event: RequestEvent) => Response;