portal-dashboard/app/entry.server.tsx

20 lines
551 B
TypeScript
Raw Normal View History

2024-03-05 16:56:17 +00:00
import type { EntryContext } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import { renderToString } from "react-dom/server";
export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
let html = renderToString(
<RemixServer context={remixContext} url={request.url} />
);
html = "<!DOCTYPE html>\n" + html;
return new Response(html, {
headers: { "Content-Type": "text/html" },
status: responseStatusCode,
});
}