Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

trpc.ts

13 lines459 Bytes

1import { createTRPCClient, httpBatchLink } from '@trpc/client'
2import type { AppRouter } from './server/trpc'
3​
4export const trpc = createTRPCClient<AppRouter>({
5 links: [
6 httpBatchLink({
7 // since we are using Vite, the server is running on the same port,
8 // this means in dev the url is `http://localhost:3000/trpc`
9 // and since its from the same origin, we don't need to explicitly set the full URL
10 url: '/trpc',
11 }),
12 ],
13})