Skip to content

Commit 23a81ae

Browse files
committed
README updated
1 parent 63ac3fc commit 23a81ae

File tree

1 file changed

+55
-46
lines changed

1 file changed

+55
-46
lines changed

README.md

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,73 @@
1-
### Cross-Platform .NET Core HTTP Base Flying Proxy
1+
### Cross-Platform .NET Standard HTTP Base Flying Proxy
22

3-
This project is demonstrating manage and consume distributed API - Micro Service
4-
from different regions (endpoints) with ease.
3+
This project is demonstrating manage and consume distributed HTTP APIs and Micro Services
4+
from different regions (hosts) with ease.
55

6-
Flying Proxy allows the management of scalable applications, trigger many operations at the same time from your clients (SPA Web App or Mobile App) and
7-
start to consume your new resource (Backend Instance, APIs) that you can simply add.
6+
Flying Proxy allows the management of scalable applications, trigger many operations at the same time from your clients (Desktop, Web or Mobile App) and start to consume your new resources that you can simply add.
87

98
Flying Proxy aims to:
109
- Simple scalability
1110
- Effective and type-safe management of distributed architecture
1211
- Better performance
1312
- Maintainability
14-
- Provide updated API or SDK usage
1513

16-
[Latest release on Nuget](https://www.nuget.org/packages/NetCoreStack.Proxy/)
14+
### Sample Client (Web)
15+
16+
#### Add ProxySettings section to the appsettings.json
17+
```json
18+
"ProxySettings": {
19+
"RegionKeys": {
20+
"Main": "http://localhost:5000/,http://localhost:5001/",
21+
"Authorization": "http://localhost:5002/",
22+
"Integrations": "http://localhost:5003/"
23+
}
24+
}
25+
```
26+
27+
#### APIs Definitions
28+
```csharp
29+
// This API expose methods from localhost:5000 and localhost:5001 as configured on ProxySettings
30+
[ApiRoute("api/[controller]", regionKey: "Main")]
31+
public interface IGuidelineApi : IApiContract
32+
{
33+
[HttpHeaders("X-Method-Header: Some Value")]
34+
Task TaskOperation();
35+
36+
int PrimitiveReturn(int i, string s, long l, DateTime dt);
37+
38+
Task<IEnumerable<SampleModel>> GetEnumerableModels();
1739

18-
### Usage for Client Side
40+
Task GetWithReferenceType(SimpleModel model);
41+
42+
/// <summary>
43+
/// Default Content-Type is ModelAware.
44+
/// If the any parameter(s) has FormFile type property that will be MultipartFormData
45+
/// if not will be JSON
46+
/// </summary>
47+
/// <param name="model"></param>
48+
/// <returns></returns>
49+
[HttpPostMarker]
50+
Task TaskActionPost(ComplexTypeModel model);
51+
52+
/// <summary>
53+
/// Template and parameter usage, key parameter will be part of the request Url
54+
/// and extracting it as api/guideline/kv/<key>
55+
/// </summary>
56+
/// <param name="key"></param>
57+
/// <param name="body"></param>
58+
/// <returns></returns>
59+
[HttpPutMarker(Template = "kv/{key}")]
60+
Task<bool> CreateOrUpdateKey(string key, Bar body);
61+
}
62+
```
1963

2064
#### Startup ConfigureServices
2165
```csharp
2266
public void ConfigureServices(IServiceCollection services)
2367
{
24-
// Add NetCoreProxy Dependencies and Configuration
2568
services.AddNetCoreProxy(Configuration, options =>
2669
{
27-
// Register the API to use as Proxy
70+
// Register the API to use as a Proxy
2871
options.Register<IGuidelineApi>();
2972
});
3073

@@ -33,7 +76,7 @@ public void ConfigureServices(IServiceCollection services)
3376
}
3477
```
3578

36-
#### Example dependency injection
79+
#### Proxy Usage (DI)
3780
```csharp
3881
public class TestController : Controller
3982
{
@@ -52,41 +95,6 @@ public class TestController : Controller
5295
}
5396
```
5497

55-
#### Add configuration section to the appsettings.json file (or your configuration file)
56-
##### Example:
57-
```json
58-
"ProxySettings": {
59-
"RegionKeys": {
60-
"Main": "http://localhost:5000/,http://localhost:5001/",
61-
"Authorization": "http://localhost:5002/",
62-
"Integrations": "http://localhost:5003/"
63-
}
64-
}
65-
```
66-
67-
### Usage for Contracts (Common) Side
68-
69-
#### API Contract Definition (Default HttpMethod is HttpGet)
70-
```csharp
71-
// This API expose methods from localhost:5000 and localhost:5001 as configured on ProxySettings
72-
[ApiRoute("api/[controller]", regionKey: "Main")]
73-
public interface IGuidelineApi : IApiContract
74-
{
75-
void VoidOperation();
76-
77-
int PrimitiveReturn(int i, string s, long l, DateTime dt);
78-
79-
Task TaskOperation();
80-
81-
Task<IEnumerable<Post>> GetPostsAsync();
82-
83-
Task GetWithReferenceType(SimpleModel model);
84-
85-
[HttpPostMarker]
86-
Task TaskActionPost(SimpleModel model);
87-
}
88-
```
89-
9098
### Backend - Server Side
9199
#### API Contract Implementation
92100
```csharp
@@ -173,6 +181,7 @@ Use [HttpLive](https://github.com/gencebay/httplive)
173181

174182
httplive -p 5003,5004 -d test/NetCoreStack.Proxy.Tests/httplive.db
175183

184+
[Latest release on Nuget](https://www.nuget.org/packages/NetCoreStack.Proxy/)
176185

177186
### Prerequisites
178187
> [ASP.NET Core](https://github.com/aspnet/Home)

0 commit comments

Comments
 (0)