Replies: 14 comments 13 replies
-
First of all, I want to say that I really like and enjoy the experience of the developer of Elysia x Eden. I am very grateful for this wonderful library! FeaturesI would like to be able to pass a function into the headers so that I can dynamically apply the data. import { edenTreaty } from '@elysiajs/eden'
import type { app } from 'server'
export const api = edenTreaty<typeof app>('http://localhost:3000', {
$fetch: {
headers: () => ({
Authorization: `Bearer ${localStorage.getItem('__sessionId')}`,
}),
},
}) Now I have to pass sessionId to const res = await api.auth.me.get({
$headers: {
Authorization: `Bearer ${localStorage.getItem('__sessionId')}`,
},
}) PerfomanceI also noticed a large delay in autocompletion. I have about 15 routes in the application here. eden.mov
|
Beta Was this translation helpful? Give feedback.
-
I've been utilizing Eden Treaty for about a month now, and it's significantly influenced my decision to use Elysia JS for my projects. The experience has been quite positive, but there are two enhancements that I believe could make Eden Treaty even more effective:
|
Beta Was this translation helpful? Give feedback.
-
I absolutely love Elysia’s API and Eden is no less admired. Eden has made it much easier for me to sell the idea of us running our backend on it — we’re going to start a new project and Elysia has been picked as the technology! With that said there’s always a bit of feedback, and here’s mine:
Overall, what a great time to be delving into http servers in typescript. Performance is through the roof and DX is unparalleled! |
Beta Was this translation helpful? Give feedback.
-
Hey! My suggestions are already on the Eden Treaty repo as issues, so I will link them here if you would like to take a look at them:
|
Beta Was this translation helpful? Give feedback.
-
Aside from type inference perf,
|
Beta Was this translation helpful? Give feedback.
-
My only concern is the default behavior of Eden client side when you work with formData for uploading file through the API elysiajs/eden#32 |
Beta Was this translation helpful? Give feedback.
-
Similar to what other before have requested, the main thing i'd like is being able to automate functionality for all requests, highest priority would be adding authorisation headers etc... so we don't have to add to each individual request some kind of response handler that is run on all requests, even just trigger a function that is passed in the initialisation (with the respose passed as an |
Beta Was this translation helpful? Give feedback.
-
I recently take a look at Eden treaty proxy implementation.
|
Beta Was this translation helpful? Give feedback.
-
I'll add my feedback for the new treaty here real quick: I want to explicitly set the return type of my function. Previously I did this: TreatyType["domain"][string]["user"][string]["get"]; now I need to do this: ReturnType<ReturnType<TreatyType["domain"]>["user"]>["get"] which is a little more verbose but not too terrible. But one thing thats a problem which I didn't manage to solve yet is, that if I have multiple routes at that or parent locations, Typescript cannot say for sure that the return of the Otherwise: Great work! Thanks! |
Beta Was this translation helpful? Give feedback.
-
Would like to see an add-on extension to Eden to wrap https://tanstack.com/query with full type support. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Awesome client side! I'm still unsure about how to use query params on the server and client, so I use body + POST everywhere for now. I'm using tanstack query, and I have to modify the fetcher to throw error so that tanstack properly triggers onError: const client = treaty<Server>(domain, {
fetch: { credentials: "include" },
fetcher: async (url, options) => {
const response = await fetch(url, options);
if (response.status >= 400) {
const clone = response.clone();
const data = await clone.json();
throw data;
}
return response;
},
}); Would be awesome to be able to configure treaty to throw errors with the message as an option. Thanks for the library! I prefer Elysia + Treaty other anything else so far (express, hono) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Is not working with Bun Workspaces |
Beta Was this translation helpful? Give feedback.
-
We would love to hear your thought, and feedback on your experience with Eden Treaty for an improvement.
You may come up with anything related to Eden Treaty, for example:
If you don't know what to feedback, here's some example:
Your feedback and idea will be used to improve Elysia and Eden Treaty for a better experience, thank you.
Beta Was this translation helpful? Give feedback.
All reactions