We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c3614e commit caedc3cCopy full SHA for caedc3c
benchmarks/trpc-router.cjs
@@ -1,18 +1,16 @@
1
'use strict'
2
3
-const trpc = require('@trpc/server')
+const { initTRPC } = require('@trpc/server')
4
const { fastifyTRPCPlugin } = require('@trpc/server/adapters/fastify')
5
-
6
const fastify = require('fastify')()
7
8
-// https://trpc.io/docs/v9/router
9
-const appRouter = trpc
10
- .router()
11
- .query('', {
12
- resolve: () => {
13
- return { hello: 'world' }
14
- }
15
- })
+// https://trpc.io/docs/v11/router
+const t = initTRPC.create()
+const appRouter = t.router({
+ hello: t.procedure.query(() => {
+ return { hello: 'world' }
+ }),
+})
16
17
fastify.register(fastifyTRPCPlugin, {
18
prefix: '',
0 commit comments