@elysiajs/eden
Fully type-safe Elysia client refers to the documentation
Installation
bun add elysia @elysiajs/eden
Example
import { Elysia, t } from 'elysia'
const app = new Elysia()
.get('/', () => 'Hi Elysia')
.get('/id/:id', ({ params: { id } }) => id)
.post('/mirror', ({ body }) => body, {
schema: {
body: t.Object({
id: t.Number(),
name: t.String()
})
}
})
.listen(8080)
export type App = typeof app
import { edenTreaty } from '@elysiajs/eden'
import type { App } from './server'
const app = edenTreaty<App>('http://localhost:8080')
const { data: pong } = app.index.get()
const { data: id } = client.id.1895.get()
const { data: nendoroid } = app.mirror.post({
id: 1895,
name: 'Skadi'
})