oRPC
background

Vanilla

Fully typed client for Vanilla JS

Installations

npm i @orpc/client

Usage

To create a fully typed client, you need either the type of the router you intend to use or the contract.

import { ,  } from '@orpc/client'
import type {  } from 'examples/server'
 
const  = <typeof  /* or contract router */>({
  : 'http://localhost:3000/api',
  // fetch: optional override for the default fetch function
  // headers: provide additional headers
})
 
//  File upload out of the box
const  = await ..({
  : 'My Amazing Title',
  : 'This is a detailed description of my content',
  : (.('thumb') as HTMLInputElement).[0]!,
})
 
..
  • create
  • find

On this page