-
|
I get the idea that we use the generated client library in the actual client application, like the flutter app. My situation needs a classic Rest API response delivered via something like I do understand that I can access DB through the passed session object, in several of the web server handlers. I could obviously do what I need through that. But a lot of my CRUD logic is pretty well implemented in the Endpoint. Now how do I benefit from that ? Is it that you do the same I think this question might be related to another one which I found in the discussion, asking if one could call an endpoint from another endpoint. *** Update *** I've done this in a bit of a roundabout way. In server.dart and in the notes_api_route.dart It worked for me. But is this a good approach ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hey @robythomas 👋 I would recommend moving the logic that you would like to share out from the endpoint and then make both the endpoint and the relic route call that same place. There is no need for this logic to be defined solely in an endpoint, and if it is shared between multiple places it your code it also makes it clear that the logic is not solely connected to an RPC call from the client. |
Beta Was this translation helpful? Give feedback.
Hey @robythomas 👋
I would recommend moving the logic that you would like to share out from the endpoint and then make both the endpoint and the relic route call that same place.
There is no need for this logic to be defined solely in an endpoint, and if it is shared between multiple places it your code it also makes it clear that the logic is not solely connected to an RPC call from the client.