.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.

First, choose the ASP.NET Core Web Application template.

Next, give it a name.

Next, choose the API template.

You need to install the Swashbuckle package for ASP Core.

Next, add these lines of codes to your Startup.cs file.

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



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store