Elysia Integration
Elysia is a high-performance web framework for Bun that adheres to the Fetch API. For additional context, refer to the Fetch Server Integration guide.
Basic
ts
import { Elysia } from 'elysia'
import { OpenAPIHandler } from '@orpc/openapi/fetch'
const handler = new OpenAPIHandler(router)
const app = new Elysia()
.all('/rpc*', async ({ request }: { request: Request }) => {
const { response } = await handler.handle(request, {
prefix: '/rpc',
})
return response ?? new Response('Not Found', { status: 404 })
})
.listen(3000)
console.log(
`🦊 Elysia is running at http://localhost:3000`
)
INFO
The handler
can be any supported oRPC handler, such as RPCHandler, OpenAPIHandler, or another custom handler.