CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
README.md74 linesDownload Raw Back to client
1<p align="center">2  <a href="https://trpc.io/"><img src="https://assets.trpc.io/icons/svgs/blue-bg-rounded.svg" alt="tRPC" height="75"/></a>3</p>4 5<h3 align="center">tRPC</h3>6 7<p align="center">8  <strong>End-to-end typesafe APIs made easy</strong>9</p>10 11<p align="center">12  <img src="https://assets.trpc.io/www/v10/v10-dark-landscape.gif" alt="Demo" />13</p>14 15# `@trpc/client`16 17> Communicate with a tRPC server on the client side.18 19## Documentation20 21Full documentation for `@trpc/client` can be found [here](https://trpc.io/docs/vanilla)22 23## Installation24 25```bash26# npm27npm install @trpc/client28 29# Yarn30yarn add @trpc/client31 32# pnpm33pnpm add @trpc/client34 35# Bun36bun add @trpc/client37```38 39## AI Agents40 41If you use an AI coding agent, install tRPC skills for better code generation:42 43```bash44npx @tanstack/intent@latest install45```46 47## Basic Example48 49```ts50import { createTRPCClient, httpBatchLink } from '@trpc/client';51// Importing the router type from the server file52import type { AppRouter } from './server';53 54// Initializing the tRPC client55const trpc = createTRPCClient<AppRouter>({56  links: [57    httpBatchLink({58      url: 'http://localhost:3000/trpc',59    }),60  ],61});62 63async function main() {64  // Querying the greeting65  const helloResponse = await trpc.greeting.query({66    name: 'world',67  });68 69  console.log('helloResponse', helloResponse); // Hello world70}71 72main();73```74