From 878eef648553cef382909608a870ffb4ee952260 Mon Sep 17 00:00:00 2001 From: Basique Evangelist Date: Tue, 2 Mar 2021 22:10:16 +0300 Subject: [PATCH] Remove echo route and add hello route --- JetHerald/Controllers/EchoController.cs | 23 ----------------------- JetHerald/Controllers/HelloController.cs | 21 +++++++++++++++++++++ JetHerald/Controllers/ReportController.cs | 2 +- 3 files changed, 22 insertions(+), 24 deletions(-) delete mode 100644 JetHerald/Controllers/EchoController.cs create mode 100644 JetHerald/Controllers/HelloController.cs diff --git a/JetHerald/Controllers/EchoController.cs b/JetHerald/Controllers/EchoController.cs deleted file mode 100644 index e9a3015..0000000 --- a/JetHerald/Controllers/EchoController.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace JetHerald.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class EchoController : ControllerBase - { - [HttpGet] - public async Task Get(string msg) - { - await Task.Delay(100); - return Ok(msg); - } - - [HttpPost] - public IActionResult GetSync(string msg) - { - return Ok(msg); - } - } -} \ No newline at end of file diff --git a/JetHerald/Controllers/HelloController.cs b/JetHerald/Controllers/HelloController.cs new file mode 100644 index 0000000..672a46b --- /dev/null +++ b/JetHerald/Controllers/HelloController.cs @@ -0,0 +1,21 @@ +using System.Reflection; +using Microsoft.AspNetCore.Mvc; + +namespace JetHerald.Controllers +{ + [ApiController] + public class HelloController : ControllerBase + { + [Route("api/hello")] + [HttpGet] + public object Hello() + { + return new + { + status = "OK", + server_name = "JetHerald", + server_version = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion + }; + } + } +} \ No newline at end of file diff --git a/JetHerald/Controllers/ReportController.cs b/JetHerald/Controllers/ReportController.cs index c129978..7cfc709 100644 --- a/JetHerald/Controllers/ReportController.cs +++ b/JetHerald/Controllers/ReportController.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Mvc; namespace JetHerald.Controllers { - [Route("api/[controller]")] [ApiController] public class ReportController : ControllerBase { @@ -18,6 +17,7 @@ namespace JetHerald.Controllers Db = db; } + [Route("api/report")] [HttpPost] public async Task Post([FromBody] ReportArgs args) {