mirror of
https://github.com/yawaflua/SkinsApi.git
synced 2025-12-09 03:49:32 +02:00
Add ping controller and cleaning code
This commit is contained in:
15
Controllers/Default/PingController.cs
Normal file
15
Controllers/Default/PingController.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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")]
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user