Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

@uni-helper/trpc-client

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uni-helper/trpc-client

The tRPC uni-app client library

latest
Source
npmnpm
Version
0.0.1-beta.7
Version published
Maintainers
3
Created
Source

tRPC tRPC

tRPC x uni-app

End-to-end typesafe APIs made easy

Demo

@uni-helper/trpc-client

兼容uni-app的trpc客户端.

Documentation

查阅@trpc/client的完整文档,请访问这里

Installation

# npm
npm install @uni-helper/trpc-client

# Yarn
yarn add @uni-helper/trpc-client

# pnpm
pnpm add @uni-helper/trpc-client

# Bun
bun add @uni-helper/trpc-client

Basic Example

import { createTRPCClient, httpBatchLink } from '@uni-helper/trpc-client'
// Importing the router type from the server file
import type { AppRouter } from './server'

// Initializing the tRPC client
const trpc = createTRPCClient<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()

FAQs

Package last updated on 11 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts