-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added HomeController and VersionController. (#19)
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
backend/src/Logitar.Wishes.Web/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Logitar.Wishes.Web.Controllers; | ||
|
||
[ApiExplorerSettings(IgnoreApi = true)] | ||
[Route("")] | ||
public class HomeController : ControllerBase | ||
{ | ||
private readonly Version _version; | ||
|
||
public HomeController(IConfiguration configuration) | ||
{ | ||
_version = new Version(configuration.GetValue<string>("Version") ?? string.Empty); | ||
} | ||
|
||
[HttpGet] | ||
public ActionResult Index() => Ok($"Wishes API v{_version}"); | ||
} |
19 changes: 19 additions & 0 deletions
19
backend/src/Logitar.Wishes.Web/Controllers/VersionController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Logitar.Wishes.Web.Models.Version; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Logitar.Wishes.Web.Controllers; | ||
|
||
[ApiController] | ||
[Route("version")] | ||
public class VersionController : ControllerBase | ||
{ | ||
private readonly Version _version; | ||
|
||
public VersionController(IConfiguration configuration) | ||
{ | ||
_version = new Version(configuration.GetValue<string>("Version") ?? string.Empty); | ||
} | ||
|
||
[HttpGet] | ||
public ActionResult<ApplicationVersion> Get() => Ok(new ApplicationVersion(_version)); | ||
} |
11 changes: 11 additions & 0 deletions
11
backend/src/Logitar.Wishes.Web/Models/Version/ApplicationVersion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Logitar.Wishes.Web.Models.Version; | ||
|
||
public record ApplicationVersion | ||
{ | ||
public string Version { get; } | ||
|
||
public ApplicationVersion(System.Version version) | ||
{ | ||
Version = version.ToString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"Version": "0.1.1" | ||
"Version": "0.1.2" | ||
} |