Skip to content

Instantly share code, notes, and snippets.

@lawrencecchen
Created January 8, 2025 03:47
Show Gist options
  • Save lawrencecchen/33130f8a5609fa0eef43328a5e7bf348 to your computer and use it in GitHub Desktop.
Save lawrencecchen/33130f8a5609fa0eef43328a5e7bf348 to your computer and use it in GitHub Desktop.
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