I think we all can be honest and say that swagger is the most helpful tool when developing an API. Sometimes it’s a hassle to install it. Personally, I would like it to be included in the API template of Visual Studio. So #vs2019 if you are reading, add it to the template, please.
Creating the API using Visual Studio 2019
First, choose the ASP.NET Core Web Application template.
Press enter or click to view image in full size
Next, give it a name.
Press enter or click to view image in full size
Next, choose the API template.
Press enter or click to view image in full size
Installing the NuGet packages
You need to install the Swashbuckle package for ASP Core.
Adding the lines of code
Next, add these lines of codes to your Startup.cs file.
Press enter or click to view image in full size
Testing
If you followed the steps nicely the swagger will be running.