Issue #1: scaffold gateway solution and projects
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using MxGateway.Contracts;
|
||||
|
||||
namespace MxGateway.Server;
|
||||
|
||||
public static class GatewayApplication
|
||||
{
|
||||
public static WebApplication Build(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = CreateBuilder(args);
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.MapGatewayEndpoints();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
public static WebApplicationBuilder CreateBuilder(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static IEndpointRouteBuilder MapGatewayEndpoints(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
endpoints.MapGet("/", () => Results.Redirect("/health/live"));
|
||||
|
||||
endpoints.MapGet(
|
||||
"/health/live",
|
||||
() => Results.Ok(new GatewayHealthReply(
|
||||
Status: "Healthy",
|
||||
DefaultBackend: GatewayContractInfo.DefaultBackendName,
|
||||
WorkerProtocolVersion: GatewayContractInfo.WorkerProtocolVersion)))
|
||||
.WithName("LiveHealth");
|
||||
|
||||
return endpoints;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user