Skip to content

Commit caedc3c

Browse files
committed
chore: update trpc example for v11
1 parent 1c3614e commit caedc3c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

benchmarks/trpc-router.cjs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
'use strict'
22

3-
const trpc = require('@trpc/server')
3+
const { initTRPC } = require('@trpc/server')
44
const { fastifyTRPCPlugin } = require('@trpc/server/adapters/fastify')
5-
65
const fastify = require('fastify')()
76

8-
// https://trpc.io/docs/v9/router
9-
const appRouter = trpc
10-
.router()
11-
.query('', {
12-
resolve: () => {
13-
return { hello: 'world' }
14-
}
15-
})
7+
// https://trpc.io/docs/v11/router
8+
const t = initTRPC.create()
9+
const appRouter = t.router({
10+
hello: t.procedure.query(() => {
11+
return { hello: 'world' }
12+
}),
13+
})
1614

1715
fastify.register(fastifyTRPCPlugin, {
1816
prefix: '',

0 commit comments

Comments
 (0)