serve original openapi json
This commit is contained in:
24
OpenAPIDocCtrl.cs.tmpl
Normal file
24
OpenAPIDocCtrl.cs.tmpl
Normal 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user