-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server side calls #436
Labels
Comments
Thanks for sharing this! I am looking for a rest-like tRPC alternative which allows for server side calls from within the same process as well as client side calls from the browser without the need to take care of the transport layer. This looks promising! Wondering if there are clever ways to avoid the type hacking and if there are any caveats. |
This is a necessary feature imo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tRPC supports a concept they call "Server Side Calls", which means you can call the router endpoints inside the same Node process. This would be very useful in ts-rest as well, especially in Next.js – you could define the API logic in one central place, and use the operations not only from the client components over HTTP but also within the server.
I had to test this out, and I'm able to achieve this already by doing this hack in my server component:
but it would be great to have an official way to do something similar.
Here are the other relevant files for future reference:
This has been an awesome lib so far!
The text was updated successfully, but these errors were encountered: