Learn ASP.NET Core MVC with Swagger UI2 min read

In this Blog, we will learn ASP.NET Core MVC with testing API in swagger UI

What is swagger UI?

Swagger tooling for API’s build with asp.net core and it will generate beautiful API Documentation. Including UI to explore and test operations directly from your routes, Controllers and models. It requires minimal coding and maintenance, allowing you to focus on building an awesome API

Installing Swagger

Right click on your project. Select Manage NuGet Packages. We need to add this packages Swagger in browser tab. Once you installed in your project you can able to use you code.

Install over the package manager console


Install-Package Swashbuckle.AspNetCore.Swagger -Version 4.0.1

Using Swagger code for API

Open startup.cs file to add swagger service method

Add the below line in you configure method

Right click on your project -> select Properties and go to “Debug” tab change the URL from default to swagger

Now run the application & you will see the swagger UI based result

We can able to see in swagger with json format

You can download this solution from GitHub URL