-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_app.ts
38 lines (36 loc) · 957 Bytes
/
_app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* This file contains the root router of your tRPC-backend
*/
import { createRouter } from '../createRouter';
import { postRouter } from './post';
import superjson from 'superjson';
/**
* Create your application's root router
* If you want to use SSG, you need export this
* @link https://trpc.io/docs/ssg
* @link https://trpc.io/docs/router
*/
export const appRouter = createRouter()
/**
* Add data transformers
* @link https://trpc.io/docs/data-transformers
*/
.transformer(superjson)
/**
* Optionally do custom error (type safe!) formatting
* @link https://trpc.io/docs/error-formatting
*/
// .formatError(({ shape, error }) => { })
/**
* Add a health check endpoint to be called with `/api/trpc/healthz`
*/
.query('healthz', {
async resolve() {
return 'yay!';
},
})
/**
* Merge `postRouter` under `post.`
*/
.merge('post.', postRouter);
export type AppRouter = typeof appRouter;