I want to combine Hono.js with tRPC. I followed the guide on the 3rd party middleware made by hono for a tRPC server, and now I have set up the hono tRPC server 3rd party middleware similar to the code below:
import { Hono } from 'hono'
import { trpcServer } from '@hono/trpc-server' // Deno 'npm:@hono/trpc-server'
import { appRouter } from './router'
const app = new Hono()
app.use(
'/trpc/*',
trpcServer({
router: appRouter,
})
)
export default app
Now, where should I place this code in Next.js? Should it go in app/api/[[...route]]/route.ts
or in app/api/trpc/[trpc]/route.ts
?
Also, what is the best approach regarding context—should I use the tRPC context or the Hono.js context?