File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -57,10 +57,10 @@ export type App = typeof app`
57
57
<Prism language =" typescript" >
58
58
{{
59
59
`\
60
- import { eden } from '@elysiajs/eden'
60
+ import { edenTreaty } from '@elysiajs/eden'
61
61
import type { App } from './server'
62
62
63
- const api = eden <App >('http://localhost')
63
+ const api = edenTreaty <App >('http://localhost')
64
64
65
65
await api.shelf.plushie.put({
66
66
name: 'Blåhaj',
Original file line number Diff line number Diff line change @@ -47,10 +47,10 @@ const app = new Elysia()
47
47
export type App = typeof app
48
48
49
49
// client.ts
50
- import { eden } from '@elysiajs/eden'
50
+ import { edenTreaty } from '@elysiajs/eden'
51
51
import type { App } from 'server'
52
52
53
- const api = eden <App>('http://0.0.0.0:8080')
53
+ const api = edenTreaty <App>('http://0.0.0.0:8080')
54
54
55
55
// Fully type-safe both client/server like tRPC
56
56
await api.auth.signIn.post(data)
Original file line number Diff line number Diff line change @@ -301,11 +301,11 @@ bun add @elysia/eden && bun add -d elysia
301
301
302
302
And in the code:
303
303
``` typescript
304
- import { eden } from ' @elysiajs/eden'
304
+ import { edenTreaty } from ' @elysiajs/eden'
305
305
import type { App } from ' ../server'
306
306
307
307
// This now has all type inference from the server
308
- const app = eden <App >(' http://localhost:3000' )
308
+ const app = edenTreaty <App >(' http://localhost:3000' )
309
309
310
310
// data will have a value of 'Hello Elysia' and has a type of 'string'
311
311
const data = await app .index .get ()
Original file line number Diff line number Diff line change @@ -103,12 +103,12 @@ import { swagger } from '@elysiajs/swagger'
103
103
And on the client:
104
104
` ` ` typescript
105
105
// client.ts
106
- import { eden } from ' @elysia/eden'
106
+ import { edenTreaty } from ' @elysia/eden'
107
107
import type { Server } from ' ./server'
108
108
109
- const app = eden <Server >(' http://localhost:8080' )
109
+ const app = edenTreaty <Server >(' http://localhost:8080' )
110
110
111
- app .signIn .POST ({
111
+ app .signIn .post ({
112
112
username: ' saltyaom' ,
113
113
password: 12345678
114
114
}).then (console .log )
You can’t perform that action at this time.
0 commit comments