Created
January 8, 2025 03:47
-
-
Save lawrencecchen/33130f8a5609fa0eef43328a5e7bf348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hono } from "hono"; | |
import { serve } from "@hono/node-server"; | |
import { serveStatic } from "@hono/node-server/serve-static"; | |
import { reactRouter } from "remix-hono/handler"; | |
// @ts-ignore | |
import * as build from "./build/server"; | |
const app = new Hono(); | |
app.use( | |
"*", | |
serveStatic({ | |
root: "./build/client", | |
}), | |
reactRouter({ | |
build, | |
mode: process.env.NODE_ENV as "development" | "production", | |
// getLoadContext is optional, the default function is the same as here | |
getLoadContext(c) { | |
return c.env; | |
}, | |
}) | |
); | |
serve({ | |
fetch: app.fetch, | |
port: 3000, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment