feat: main

This commit is contained in:
Nikolaj Frey 2023-06-27 10:28:54 +10:00
parent 68c52422cf
commit 0816b3d980
2 changed files with 21 additions and 20 deletions

View File

@ -1,8 +1,8 @@
import { renderToString } from "react-dom/server";
import { RemixServer } from "remix";
import type { EntryContext } from "remix";
import { renderToString } from 'react-dom/server'
import { RemixServer } from '@remix-run/react'
import type { EntryContext } from '@remix-run/react/dist/entry'
export default function handleRequest(
export default function handleRequest (
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
@ -10,12 +10,12 @@ export default function handleRequest(
) {
let markup = renderToString(
<RemixServer context={remixContext} url={request.url} />
);
)
responseHeaders.set("Content-Type", "text/html");
responseHeaders.set('Content-Type', 'text/html')
return new Response("<!DOCTYPE html>" + markup, {
return new Response('<!DOCTYPE html>' + markup, {
status: responseStatusCode,
headers: responseHeaders
});
})
}

View File

@ -1,30 +1,31 @@
import { ChakraProvider } from "@chakra-ui/react"
import type { MetaFunction } from "@vercel/remix"
import { ChakraProvider } from '@chakra-ui/react'
// import type { MetaFunction } from "@vercel/remix"
import type { MetaFunction } from '@remix-run/node'
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react"
import { Analytics } from "@vercel/analytics/react"
ScrollRestoration
} from '@remix-run/react'
import { Analytics } from '@vercel/analytics/react'
export const meta: MetaFunction = () => ({
charset: "utf-8",
title: "New Remix App",
viewport: "width=device-width,initial-scale=1",
charset: 'utf-8',
title: 'New Remix App',
viewport: 'width=device-width,initial-scale=1'
})
function Document({
function Document ({
children,
title = "App title",
title = 'App title'
}: {
children: React.ReactNode
title?: string
}) {
return (
<html lang="en">
<html lang='en'>
<head>
<Meta />
<title>{title}</title>
@ -41,7 +42,7 @@ function Document({
)
}
export default function App() {
export default function App () {
return (
<Document>
<ChakraProvider>