You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+45-22Lines changed: 45 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,37 @@ Mainly a generator project, to create REST API and appropriate interfaces for ea
4
4
- Based on interface definition in Shared project
5
5
- Create Controller based REST API, to be used in Backend (respecting Authorize attribute).
6
6
- Create a client to be used in Razor Components in WebAssembly Render mode, which calls the REST API above.
7
-
- Add wrapper around the service implmentation in Backend for use in ServerSide Render mode, so it is protected as the REST API is.
7
+
- Add wrapper around the service implementation in Backend for use in ServerSide Render mode, so it is protected as the REST API is.
8
8
- For the wrappers used when running on the server and in browser, to automatically implement State Persistance for use in Prerendering (to remove the flicker on mode change with prerendering)
9
9
10
-
# Usage
10
+
This means, that you define the interface in Shared project, and the generator will create the necessary code for you.
11
+
Handling different render modes as needed and abstracting away the details from Razor Components pages.
12
+
13
+
Adding or updating the API, means adding a method any of the existing marked interfaces or creating new interfaces in the shared project.
14
+
And of course implementing this interface in the backend and adding it to the DI container.
15
+
16
+
17
+
# Supported attributes
18
+
19
+
- GenerateHttpClients
20
+
- Assembly attribute, generates the clients for the services, to be used in Client project.
21
+
- GenerateHttpControllers
22
+
- Assembly attribute, generates the controllers and service wrappers, to be used in Backend project.
23
+
- GenerateServices
24
+
- Interface attribute, marks the interface as a service, to be used by the generator.
25
+
- PersistForPrerendering
26
+
- Generates the code for Persisting the pre-rendered state of the component, based on https://learn.microsoft.com/en-us/aspnet/core/blazor/components/prerender?view=aspnetcore-9.0#persist-prerendered-state
27
+
- Authorize
28
+
- Interface or method attribute, marks the interface or method as requiring authorization (uses the same definition as the built-in version of this attribute but is for use with interfaces).
29
+
30
+
31
+
# Usage examples
32
+
11
33
See the project in the `sample` folder.
12
34
13
-
# Version info
35
+
36
+
# Usage notice
37
+
14
38
This is only pre-alpha version for evaluating the idea, and not yet ready for production use.
15
39
Nuget package will not be released later on when the code is a bit more stable.
16
40
@@ -23,26 +47,25 @@ Nuget package will not be released later on when the code is a bit more stable.
23
47
- add Verb attribute (can be combined with route)
24
48
- add allow anonymous attribute
25
49
- release as Nuget package
26
-
50
+
- have a demo app deployment
27
51
28
52
29
53
## Similar
30
54
31
-
# https://github.com/reactiveui/refit
32
-
- Generate a REST client from code
33
-
- ie code first but only for REST Client, not for server side
34
-
- Seems alternative to Swagger somehow
35
-
36
-
# https://github.com/canton7/RestEase
37
-
- Inspired by Refit
38
-
- Seems generally the same, generate clients
39
-
40
-
41
-
https://github.com/bpawluk/EasyApi
42
-
- Handles both client and server side
43
-
- But each request is a separate class
44
-
- A bit too verbose due to that
45
-
- And due to the class per method, quite a lot needs to be injected to use adjecent functionality
46
-
- the `@inject ICall<AddComment, Guid> AddComment` is a good example of that
47
-
- you need to know what request class you want to use and what it should return.
48
-
- This seems unnecessary.
55
+
-https://github.com/reactiveui/refit
56
+
- Generate a REST client from code
57
+
- ie code first but only for REST Client, not for server side
58
+
- Seems alternative to Swagger somehow
59
+
60
+
-https://github.com/canton7/RestEase
61
+
- Inspired by Refit
62
+
- Seems generally the same, generate clients
63
+
64
+
-https://github.com/bpawluk/EasyApi
65
+
- Handles both client and server side
66
+
- But each request is a separate class
67
+
- A bit too verbose due to that
68
+
- And due to the class per method, quite a lot needs to be injected to use adjecent functionality
69
+
- the `@inject ICall<AddComment, Guid> AddComment` is a good example of that
70
+
- you need to know what request class you want to use and what it should return.
0 commit comments