1.0.2 • Published 2 months ago

@elysiajs/trpc v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@elysiajs/trpc

A plugin for elysia that adds support for using tRPC.

Installation

bun add @elysiajs/trpc

Example

import { Elysia, t } from 'elysia'
import { trpc, compile as c } from '@elysiajs/trpc'

import { initTRPC } from '@trpc/server'

const r = initTRPC.create()

const router = r.router({
    greet: r.procedure.input(c(t.String())).query(({ input }) => input)
})

export type Router = typeof router

const app = new Elysia()
    .use(trpc(router))
    .listen(8080)

API

This plugin extends the new method trpc to Elysia class.

trpc

Register tRPC router.

type tRPC = (router: Router<any>, options?: TRPCOptions) => this

export interface TRPCOptions
    extends Omit<
        FetchHandlerRequestOptions<any>,
        'req' | 'router' | 'endpoint'
    > {
    /**
     * tRPC endpoint
     *
     * @default '/trpc'
     */
    endpoint?: string
}

Note

WebSocket API is in an experimental state and unstable.

Is meant for experimental for better stabilization.

1.0.2

2 months ago

1.0.0

2 months ago

1.0.0-rc.0

2 months ago

1.0.0-beta.1

3 months ago

1.0.0-beta.0

3 months ago

0.8.0

5 months ago

0.8.0-rc.0

5 months ago

0.7.0-beta.0

8 months ago

0.7.0

8 months ago

0.6.1

9 months ago

0.6.0-rc.0

9 months ago

0.6.0

9 months ago

0.5.0-rc.1

12 months ago

0.3.0

1 year ago

0.3.0-rc.0

1 year ago

0.5.0

12 months ago

0.5.2

11 months ago

0.5.0-rc.0

12 months ago

0.5.1

11 months ago

0.2.0

1 year ago

0.1.0

1 year ago

0.1.0-rc.9

1 year ago

0.1.0-rc.8

1 year ago

0.1.0-rc.7

1 year ago

0.1.0-rc.6

1 year ago

0.1.0-rc.4

1 year ago

0.1.0-rc.3

1 year ago

0.1.0-rc.2

1 year ago

0.1.0-rc.1

1 year ago