Skip to content

Latest commit

 

History

History
47 lines (42 loc) · 1.5 KB

File metadata and controls

47 lines (42 loc) · 1.5 KB
title entry-server.tsx
use_cases server initialization, ssr setup, html document structure, meta tags, server bootstrap
tags
entry
server
ssr
initialization
document
html
version 1.0
description Define server entry point and HTML document structure for SolidStart. Configure SSR modes and set up server-side rendering bootstrap.

This is where application is rendered on the server. This happens by entry-server.tsx providing a document component to <StartServer> and passing it into createHandler for server side rendering.

Every SolidStart app must have an entry-server.tsx file, the most basic usage looks about the following example:

import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
	<StartServer
		document={({ assets, children, scripts }) => (
			<html lang="en">
				<head>
					<meta charset="utf-8" />
					<meta name="viewport" content="width=device-width, initial-scale=1" />
					<link rel="icon" href="/favicon.ico" />
					{assets}
				</head>
				<body>
					<div id="app">{children}</div>
					{scripts}
				</body>
			</html>
		)}
	/>
));

To take full advantage of the entry-server.tsx file, check the createHandler docs and the Rendering Modes page.