Best-fit companion library to Refit on the server side? #1776
-
|
While Refit is very helpful for type-safe api client, is there a server api helper library that would complement Refit very well? As an example, I have been looking at Fastendpoints, however, in that library, it would still require setting up the endpoint route and http verb again in the Configure method. I am really hoping that there is an elegant way to write the api Interface once in a Shared library (such as in a ASP.Net Core hosted Blazor Webassembly project), and then be able to use that api interface not only on the client side in refit but also the server. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
There is no official Refit server-side counterpart, but a couple of community approaches fit the "define the interface once, share it" goal:
The reason this is not built into Refit: Refit only models the client. Mapping the same interface to server routing requires an ASP.NET Core integration, which is out of scope for this library. If you want a single source of truth, the most robust paths today are gRPC (contract-first by design) or generating both client and server from an OpenAPI spec. For pure REST with a shared interface, you will need a server-side route-mapping helper; FastEndpoints does not currently bind from an interface. |
Beta Was this translation helpful? Give feedback.
There is no official Refit server-side counterpart, but a couple of community approaches fit the "define the interface once, share it" goal:
The reason…