Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 1019 Bytes

File metadata and controls

32 lines (28 loc) · 1019 Bytes
title entry-server.tsx

entry-server.tsx is where an application starts on the server. This happens by entry-server.tsx providing a document component to <StartServer> and passing it into createHandler for server side rendering. A typical entry-server.tsx for a new project looks like this:

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>
		)}
	/>
));

For setting different SSR modes (sync | async | stream), see createHandler.