Server

createHandler

Edit this page

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.

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 Signature

type RenderingModes = "stream" | "async" | "sync";
function createHandler(
handler: () => (document: any, options?: any) => void,
options?:
| { mode?: RenderingModes }
| ((event: RequestEvent) => { mode: RenderingModes })
| undefined
): (event: RequestEvent) => Response;
Report an issue with this page