.NET Core API with Swagger

--

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.

Next, give it a name.

Next, choose the API template.

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.

Testing

If you followed the steps nicely the swagger will be running.

--

--