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 Index() { return Content( await System.IO.File.ReadAllTextAsync(Path.Combine(_hostingEnvironment.WebRootPath, "openapi-original.json")), "text/plain" ); } } }