Add ping controller and cleaning code

This commit is contained in:
Dmitriy yawaflua Andreev
2024-07-31 08:02:10 +03:00
parent 6da090ac91
commit 92260f6110
6 changed files with 39 additions and 32 deletions

View File

@@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Mvc;
namespace SkinsApi.Controllers.Default
{
[Route("/ping")]
[ApiController]
public class PingController : ControllerBase
{
[HttpGet]
public async Task<IActionResult> Ping()
{
return Ok("Pong");
}
}
}

View File

@@ -5,7 +5,7 @@ namespace SkinsApi.Controllers.v1
{
[Route("/skin/")]
[ApiController]
public class AnotherSkinsController ( ISkinService skinService) : ControllerBase
public class AnotherSkinsController(ISkinService skinService) : ControllerBase
{
[HttpGet("{skin_type}/{width}/{user}")]
[Produces("image/png")]

View File

@@ -1,13 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
using SkinsApi.Interfaces.Services;
namespace SkinsApi.Controllers.v1
{
[Route("/api/v1/skin/")]
[ApiController]
public class SkinsController (ISkinService skinService): ControllerBase
public class SkinsController(ISkinService skinService) : ControllerBase
{
/// <summary>
/// Get user`s skin
@@ -50,11 +49,12 @@ namespace SkinsApi.Controllers.v1
try
{
return File((await skinService.GetSkinStreamAsync(user)).GetBody(width), "image/png");
} catch(Exception ex)
}
catch (Exception ex)
{
return NotFound();
}
}
}
}