diff --git a/WarhoundConsole/Program.cs b/WarhoundConsole/Program.cs index e2c2a11..c000392 100644 --- a/WarhoundConsole/Program.cs +++ b/WarhoundConsole/Program.cs @@ -1,8 +1,4 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Diagnostics; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; - + namespace WarhoundConsole { public class Program @@ -21,32 +17,7 @@ namespace WarhoundConsole private static void MainInternal(string[] args) { - var builder = WebApplication.CreateBuilder(args); - builder.WebHost.UseUrls("http://localhost:80"); - builder.Services.AddControllers(); - builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(); - var app = builder.Build(); - app.UseSwagger(); - app.UseSwaggerUI(); - app.MapControllers(); - app.UseExceptionHandler(ExceptionHandler); - app.Run(); - } - - private static void ExceptionHandler(IApplicationBuilder applicationBuilder) - { - applicationBuilder.Run(async context => - { - var exceptionHandlerFeature = context.Features.Get(); - if (exceptionHandlerFeature != null) - { - var exception = exceptionHandlerFeature.Error; - - // Do something here - } - }); } } } diff --git a/WarhoundConsole/Test.cs b/WarhoundConsole/Test.cs deleted file mode 100644 index 029a799..0000000 --- a/WarhoundConsole/Test.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace WarhoundConsole -{ - [ApiController] - [Route("api/test")] - public class Test : ControllerBase - { - [HttpGet("hello")] - public ActionResult GetGreeting() - { - string message = "Hello!!!"; - if (message.Length != 0) - { - //throw new Exception("Hello"); - } - return Ok(message); - } - - [HttpGet("data")] - public ActionResult GetData() - { - var data = new { Id = 1, Name = "Sample Data", Timestamp = DateTime.UtcNow }; - return Ok(data); - } - - [HttpPost("json")] - public ActionResult asd([FromBody] object obj) - { - //if (obj == null) - //{ - // return BadRequest("Invalid data."); - //} - - Console.Write(obj.ToString()); - - return Ok(new { a = 1, b = 2, c = "c" }); - } - } -}