mirror of
https://github.com/kennethnym/aris.git
synced 2026-02-02 13:11:17 +00:00
- Add @trpc/server, @hono/trpc-server, zod dependencies - Create tRPC context with BetterAuth session - Create router with publicProcedure and protectedProcedure - Mount tRPC at /trpc/* via Hono adapter Co-authored-by: Ona <no-reply@ona.com>
26 lines
462 B
TypeScript
26 lines
462 B
TypeScript
import { trpcServer } from "@hono/trpc-server"
|
|
import { Hono } from "hono"
|
|
|
|
import { registerAuthHandlers } from "./auth/http.ts"
|
|
import { createContext } from "./trpc/context.ts"
|
|
import { appRouter } from "./trpc/router.ts"
|
|
|
|
const app = new Hono()
|
|
|
|
app.get("/health", (c) => c.json({ status: "ok" }))
|
|
|
|
registerAuthHandlers(app)
|
|
|
|
app.use(
|
|
"/trpc/*",
|
|
trpcServer({
|
|
router: appRouter,
|
|
createContext,
|
|
}),
|
|
)
|
|
|
|
export default {
|
|
port: 3000,
|
|
fetch: app.fetch,
|
|
}
|