summaryrefslogtreecommitdiffstats
path: root/server/src/Endpoints/Internal/Root/GetApplicationVersionRoute.cs
blob: 5fb8213a139accb160d035699c1105a410e8dbd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace IOL.GreatOffice.Api.Endpoints.Internal.Root;

public class GetApplicationVersionRoute : RouteBaseSync.WithoutRequest.WithActionResult<string>
{
	private readonly IWebHostEnvironment _environment;

	/// <inheritdoc />
	public GetApplicationVersionRoute(IWebHostEnvironment environment) {
		_environment = environment;
	}

	/// <summary>
	/// Get the running api version number.
	/// </summary>
	/// <returns></returns>
	[HttpGet("~/_/version")]
	public override ActionResult<string> Handle() {
		var versionFilePath = Path.Combine(_environment.WebRootPath, "version.txt");
		return Ok(System.IO.File.ReadAllText(versionFilePath));
	}
}