29 lines
757 B
C#
29 lines
757 B
C#
using Microsoft.AspNetCore.Http.HttpResults;
|
|
|
|
namespace Vegasco.WebApi.Info;
|
|
|
|
public class GetServerInfo
|
|
{
|
|
public record Response(
|
|
string FullVersion,
|
|
string CommitId,
|
|
DateTime CommitDate,
|
|
string Environment);
|
|
|
|
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
|
{
|
|
return builder
|
|
.MapGet("info/server", Endpoint)
|
|
.WithTags("Info");
|
|
}
|
|
|
|
private static Ok<Response> Endpoint(
|
|
IHostEnvironment environment)
|
|
{
|
|
return TypedResults.Ok(new Response(
|
|
ThisAssembly.AssemblyInformationalVersion,
|
|
ThisAssembly.GitCommitId,
|
|
ThisAssembly.GitCommitDate,
|
|
environment.EnvironmentName));
|
|
}
|
|
} |