Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 827 Bytes

README_Middleware_Service.md

File metadata and controls

38 lines (27 loc) · 827 Bytes

Api Gateway Middleware Service

The library provides an interface your Gateway API can implement to hook into the Gateway's middleware.

In your Gateway API project,

you can hook into middleware service by implementing the below interface.

Task Invoke(HttpContext context, string apiKey, string routeKey);

Example

In your Gateway API project,

  • Create a service like below
    public class GatewayMiddlewareService : IGatewayMiddleware
    {
        public async Task Invoke(HttpContext context, string apiKey, string routeKey)
        {
            //do your work here

            await Task.CompletedTask;
        }
    }
  • Wire it up for dependency injection in Startup.cs
services.AddTransient<IGatewayMiddleware, GatewayMiddlewareService>();
.
.
services.AddApiGateway();