Swagger UI Integration to .Net core Web API in 4 Steps

Swagger helps you to manage your API's from the code base itself. You don't need to go for any other third party API testing tools like Postman,Soap UI etc.

So here are the integration steps.



Step 1:
Create a .Net core web api project using visual studio

Step 2:
Install the 'Swashbuckle.AspNetCore' nuget package using Nuget package manager

Step 3:
Go to the Startup.cs file in the project and below code in the 'Configure' method.

        app.UseSwaggerUI(c =>
        {
            c.SwaggerEndpoint("/swagger/v1/swagger.json","Inventory API");
        });
Step 4: Add the below code in 'ConfigureServices' method
       services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new Info
            {
                Version = "v1",
                Title = "Inventory API",
                Description = "Testing"  
            });
        });

You need only these 4 steps to integrate the swagger UI.

Now run the project in visual studio and in browser add swagger after the  localhost port and hit enter
Bingo your swagger is ready to use.
https://localhost:44309/swagger/index.html

Another way is change the launch url in launchSetting.json to swagger
which is present under the project proerties

"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }



.net core configuration in visual studio 2015, Hello world in .net core

Microsoft's powerful open source development platform .net core is the new trending technology in the tech market, so if you have visual studio 2015 you can do the development in easy updates.
So I will be explaining the steps required to configure the .net core in visual studio 2015.
1. download the visual studio update for 2015: download
    If you don't have the visual studio 2015: download
2. Download the .net core tool for the visual studio: download

I hope you have downloaded and installed all the above items, now we are good to go to the next step
So let us create a hello world console application using .net core
Select the new project option from vs you can see the .net core option under C#
select the console application and create one project with that


now you can just write the code in the same way you used to write with C#

The DLL generated in windows machine for this application you can run in Mac/Linux it will give you the same result.

you can check more details here :details