From a640703f2da8815dc26ad1600a6f206be1624379 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 1 Jun 2022 22:10:32 +0200 Subject: feat: Initial after clean slate --- .../Internal/Root/GetApplicationVersionRoute.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs (limited to 'server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs') diff --git a/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs b/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs new file mode 100644 index 0000000..5fb8213 --- /dev/null +++ b/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs @@ -0,0 +1,21 @@ +namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; + +public class GetApplicationVersionRoute : RouteBaseSync.WithoutRequest.WithActionResult +{ + private readonly IWebHostEnvironment _environment; + + /// + public GetApplicationVersionRoute(IWebHostEnvironment environment) { + _environment = environment; + } + + /// + /// Get the running api version number. + /// + /// + [HttpGet("~/_/version")] + public override ActionResult Handle() { + var versionFilePath = Path.Combine(_environment.WebRootPath, "version.txt"); + return Ok(System.IO.File.ReadAllText(versionFilePath)); + } +} -- cgit v1.3