TRPC
v0.1.0 — tRPC bridge — mount tRPC into Hyper, or convert a tRPC router to Hyper routes.
$ hyper add trpc
Copies 4 files into src/hyper/trpc/ and updates hyper.lock.json.
DEPS
- registry: core
- optional: @trpc/server@>=11.0.0 <12.0.0
FILES
- trpc/bridge.ts
- trpc/index.ts
- trpc/to-hyper.ts
- trpc/types.ts
README
@hyper/trpc
tRPC bridge — mount tRPC into Hyper, or convert a tRPC router into Hyper routes.
Install
Components are installed as source into your repo, not pulled from npm:
bunx hyper add trpc
Wires the alias @hyper/trpc to src/hyper/trpc/ (configurable in hyper.config.json). See hyperjs.ai for the full registry.
Usage
Mount a tRPC router inside a Hyper app:
import { Hyper } from "@hyper/core"
import { trpcPlugin } from "@hyper/trpc"
import { appRouter } from "./trpc/router.ts"
export default new Hyper()
.use(trpcPlugin({ router: appRouter, prefix: "/trpc" }))
.listen(3000)
Or convert a Hyper app into a tRPC router:
import { toTrpcRouter } from "@hyper/trpc"
import { initTRPC } from "@trpc/server"
import app from "./app.ts"
const t = initTRPC.create()
export const trpcRouter = toTrpcRouter(app, { t })
Docs
See the main README and docs/ for guides and integration recipes.
License
MIT
MANIFEST
- /r/trpc.json — latest
- /r/trpc@0.1.0.json — immutable