feat: add file routing option

This commit is contained in:
wobsoriano
2022-11-05 19:22:19 -07:00
parent d9c8f877d3
commit 750783e860
33 changed files with 589 additions and 348 deletions

View File

@@ -0,0 +1,23 @@
import { createNuxtApiHandler } from 'trpc-nuxt/handler'
import { appRouter } from '@/server/trpc/routers'
import { createContext } from '@/server/trpc/context'
export default createNuxtApiHandler({
router: appRouter,
/**
* @link https://trpc.io/docs/context
*/
createContext,
onError ({ error }) {
if (error.code === 'INTERNAL_SERVER_ERROR') {
// send to bug reporting
console.error('Something went wrong', error)
}
}
/**
* @link https://trpc.io/docs/caching#api-response-caching
*/
// responseMeta() {
// // ...
// },
})