File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -24,29 +24,26 @@ bun add @elysiajs/trpc @trpc/server @elysiajs/websocket
24
24
25
25
Then use it:
26
26
``` typescript
27
- import { Elysia , t as T } from ' elysia '
28
- import { trpc , compile as c } from ' @elysiajs/ trpc'
29
- import { z } from ' zod '
27
+ import { compile as c , trpc } from " @elysiajs/trpc " ;
28
+ import { initTRPC } from " @ trpc/server " ;
29
+ import { Elysia , t as T } from " elysia " ;
30
30
31
- import { initTRPC } from ' @trpc/server'
32
-
33
- const t = initTRPC .create ()
34
- const p = t .prodcedure
31
+ const t = initTRPC .create ();
32
+ const p = t .procedure ;
35
33
36
34
const router = t .router ({
37
- greet: p
38
- // or using Zod
39
- .input (z .string ())
40
- // Using Elysia's T
41
- .input (c (t .String ()))
42
- .query (({ input }) => input )
43
- })
35
+ greet: p
36
+
37
+ // 💡 Using Zod
38
+ // .input(z.string())
39
+ // 💡 Using Elysia's T
40
+ .input (c (T .String ()))
41
+ .query (({ input }) => input ),
42
+ });
44
43
45
- export type Router = typeof router
44
+ export type Router = typeof router ;
46
45
47
- const app = new Elysia ()
48
- .use (trpc (router ))
49
- .listen (8080 )
46
+ const app = new Elysia ().use (trpc (router )).listen (8080 );
50
47
```
51
48
52
49
## trpc
You can’t perform that action at this time.
0 commit comments