serve original openapi json

This commit is contained in:
2021-11-26 16:36:07 +01:00
parent 238821aed8
commit b0b286a5e7
5 changed files with 37 additions and 3 deletions

24
OpenAPIDocCtrl.cs.tmpl Normal file
View File

@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System.IO;
using System.Threading.Tasks;
namespace de.hottis.genericdatabaseapiservice.Controllers {
[Route("/${env['routeprefix']}/openapi/JSON")]
public class OpenAPIDocCtrl : ControllerBase {
private IWebHostEnvironment _hostingEnvironment;
public OpenAPIDocCtrl(IWebHostEnvironment environment) {
_hostingEnvironment = environment;
}
[HttpGet]
public async Task<IActionResult> Index() {
return Content(
await System.IO.File.ReadAllTextAsync(Path.Combine(_hostingEnvironment.WebRootPath, "openapi-original.json")),
"text/plain"
);
}
}
}