integrate swagger in .net core api
/* To use swagger in an existing .net core api ALL functions must be annotated. examples of annotations: [HttpGet], [HttpPost], [NonAction] (for non HTTP actions) To hide an endpoint from docs: [ApiExplorerSettings(IgnoreApi = true)] Make sure all controllers are annotated with the following: [Route("api/[controller]")] [ApiController] This is used to differentiate controller paths */ // in View>Other Windows>Package Manager Console add package: Install-Package Swashbuckle.AspNetCore // in startup.cs add: using Microsoft.OpenApi.Models; // in startup.cs edit functions: // ConfigureServices(): services.AddMvc(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "<title>", Version = "v1" }); }); // Configure(): app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "<title> v1")); // in launchSettings.json add to all profiles: "launchUrl": "swagger"