Bozza pubblicazione ok (manca deploy immagini test, da includere ext resources)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Lux.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ImageController : ControllerBase
|
||||
{
|
||||
public ImageController(ILogger<ImageController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
/// <summary>
|
||||
/// Chiamata GETT: riceve Json in formato JwdDto, restituisce svg file
|
||||
/// GET: api/Jwd/svg/00000000-0000-0000-0000-000000000000
|
||||
/// </summary>
|
||||
/// <param name="id">id univoco img</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("svg/{id}")]
|
||||
public async Task<IActionResult> svgFileGet(string id)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string filePath = Path.Combine("DemoImg", "AntaDoppia.svg");
|
||||
var svgContent = await System.IO.File.ReadAllTextAsync(filePath);
|
||||
var bytes = System.Text.Encoding.UTF8.GetBytes(svgContent);
|
||||
sw.Stop();
|
||||
_logger.LogInformation($"svgString | {sw.Elapsed.TotalMilliseconds:N3} ms");
|
||||
return File(bytes, "image/svg+xml");
|
||||
}
|
||||
|
||||
private readonly ILogger<ImageController> _logger;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user