Showing posts with label Swagger integration in .NetCore. Show all posts
Showing posts with label Swagger integration in .NetCore. Show all posts

Thursday, 12 December 2024

How to Integrate Swagger in .NetCore Web API project

Aim: Integrate Swagger in .NetCore Web API project
 (Visual Studio 2022 +  .NET 6)
 
1: Create new Web API project (without swagger built in integration)
We are not using OpenAPI in built from Demo.
We do all manually for better understanding
2: Install NuGet Package: SwashbuvkleAspNetCore
3: Update Program.cs file
    Builder.Services.AddSwaggerGen();
4:    Register Middleware
app.UseSwagger();
app.UseSwaggerUI()
 
To load swagger when we run project/ when we run project, landing page is swagger, 
need to update launchsetting.json file.
- set launchUrl to "swagger"

For step by step detail, watch video.