Skip to content

Commit

Permalink
Documentation update
Browse files Browse the repository at this point in the history
fancyDevelopment committed Apr 25, 2024
1 parent ef0d293 commit b1cd483
Showing 3 changed files with 32 additions and 5 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -68,25 +68,52 @@ builder.Services.AddGateway()
.LoadConfiguration(builder.Configuration.GetSection("Gateway"));
```

In your application add a configuration section with the name `"Gateway"` and create the default structure within it as shown in the following snippet:
In your application add a configuration section with the name `"Gateway"` and create the default structure within it as shown in the following sample snippet:

```json
"Gateway": {
"Routing": {
"Routes": {
"Microservice1": {
"BaseUrl": "http://localhost:5000",
}
}
}
}
```

With those three steps the library does not do anything yet but is prepared to realize one or more of the features mentioned at the beginning.
Finally you can ask for a type called `GatewayRouter` via dependency injection and use it to make calls to your microservices/backends using the name of your route in the configuration and a relative path to the data you would like to retrieve.

## Realize Features in your Gateway
```cs
[ApiController]
public class HomeController : HypermediaController
{
private readonly GatewayRouter _router;

public HomeController(GatewayRouter router)
{
_router = router;
}

[HttpGet]
[Route("api/views/home")]
public async Task<IActionResult> GetHomeViewModel()
{
var dataFromMicroservice = _router.GetAsync<TypeToDeserializeData>("Microservice1", "api/data/123");
[...]
}
}
```

With this basic set up you can make calls to your microservices easily and change the base address in the configuration. Read through the advanced features docs to extend your api gateway with more capabilities.

## Realize Advanced Features in your Gateway

To learn how each single feature can be realized have a look to the following individual guidelines.

* Aggregating data from differend sources into a client optimized model - Comming Soon
* Provide different apis and/or resources under the same origin - Comming Soon
* Create truly RESTful services - Comming Soon
* Let the gateway act as authentication facade - Comming Soon
* [Let the gateway act as authentication facade](./doc/features/authentication.md)


1 change: 1 addition & 0 deletions doc/features/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Authentication
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Fancy.ResourceLinker.Gateway;
using Fancy.ResourceLinker.Gateway.Common;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;

0 comments on commit b1cd483

Please sign in to comment.