mirror of
https://github.com/kennethnym/aris.git
synced 2026-02-02 13:11:17 +00:00
feat(backend): add tRPC with Hono adapter
- 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>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
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()
|
||||
|
||||
@@ -8,6 +11,14 @@ app.get("/health", (c) => c.json({ status: "ok" }))
|
||||
|
||||
registerAuthHandlers(app)
|
||||
|
||||
app.use(
|
||||
"/trpc/*",
|
||||
trpcServer({
|
||||
router: appRouter,
|
||||
createContext,
|
||||
}),
|
||||
)
|
||||
|
||||
export default {
|
||||
port: 3000,
|
||||
fetch: app.fetch,
|
||||
|
||||
Reference in New Issue
Block a user