Skip to content

Commit

Permalink
docs: Update Server Side Calls docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Colonel-Sandvich authored Apr 8, 2023
1 parent 38d83da commit 1c638a8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/content/1.get-started/5.tips/4.server-side-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const router = t.router({
```

```ts [server/api/greeting.ts]
import { router } from '@/server/trpc/trpc'
import { appRouter } from '@/server/trpc/routers'

export default eventHandler(async (event) => {
export default defineEventHandler(async (event) => {
const { name } = getQuery(event)
const caller = router.createCaller({})
const caller = appRouter.createCaller({})

const greeting = await caller.greeting({ name })

Expand Down Expand Up @@ -67,11 +67,11 @@ export const router = t.router({
```

```ts [server/api/post.ts]
import { router } from '@/server/trpc/trpc'
import { appRouter } from '@/server/trpc/routers'

export default eventHandler(async (event) => {
export default defineEventHandler(async (event) => {
const body = await getBody(event)
const caller = router.createCaller({})
const caller = appRouter.createCaller({})

const post = await caller.post.add(body.post)

Expand Down

0 comments on commit 1c638a8

Please sign in to comment.