25 lines
736 B
Cheetah
25 lines
736 B
Cheetah
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ${env['packagename']}.Controllers {
|
|
[Route("/${env['routeprefix']}/api/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"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|