Experiments with tRPC and Nuxt Server API

This commit is contained in:
2025-04-03 19:24:59 +02:00
parent 4c058b748b
commit b4d22ee561
10 changed files with 233 additions and 7 deletions

14
plugins/trpc.ts Normal file
View File

@@ -0,0 +1,14 @@
import { createTRPCNuxtClient, httpBatchLink } from 'trpc-nuxt/client';
import type { AppRouter } from '~/server/trpc/routers';
export default defineNuxtPlugin(() => {
const trpc = createTRPCNuxtClient<AppRouter>({
links: [httpBatchLink({ url: '/api/trpc' })],
});
return {
provide: {
trpc,
},
};
});