@pier-wallet/trpc-10-client
TypeScript icon, indicating that this package has built-in type declarations

10.37.1 • Public • Published

tRPC

tRPC

End-to-end typesafe APIs made easy

Demo

@trpc/client

Communicate with a tRPC server on the client side.

Documentation

Full documentation for @trpc/client can be found here

Installation

# npm
npm install @trpc/client

# Yarn
yarn add @trpc/client

# pnpm
pnpm add @trpc/client

# Bun
bun add @trpc/client

Basic Example

import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
// Importing the router type from the server file
import type { AppRouter } from './server';

// Initializing the tRPC client
const trpc = createTRPCProxyClient<AppRouter>({
  links: [
    httpBatchLink({
      url: 'http://localhost:3000/trpc',
    }),
  ],
});

async function main() {
  // Querying the greeting
  const helloResponse = await trpc.greeting.query({
    name: 'world',
  });

  console.log('helloResponse', helloResponse); // Hello world
}

main();

Readme

Keywords

none

Package Sidebar

Install

npm i @pier-wallet/trpc-10-client

Homepage

trpc.io

Weekly Downloads

0

Version

10.37.1

License

MIT

Unpacked Size

249 kB

Total Files

139

Last publish

Collaborators

  • olehpierwallet
  • andraspierwallet