ASP.NET Core web API with Swagger

All Code

public void ConfigureServices(IServiceCollection services)

{

services.AddControllers();

services.AddSwaggerGen(c =>

{

c.SwaggerDoc(“SwaggerExample”, new OpenApiInfo

{

Title = “Web Api Core Swagger Example”,

Version = “5.6.0”,

Description = “Swagger with ASP.NET Core 3.1”,

Contact = new OpenApiContact

{

Email = “ilhandemirtepe65@gmail.com”,

Name = “İlhan Demirtepe”

}

});

});

}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

{

app.UseSwagger().UseSwaggerUI(c =>

{

c.SwaggerEndpoint(“/swagger/SwaggerExample/swagger.json”, “Swagger Example”);

});

if (env.IsDevelopment())

{

app.UseDeveloperExceptionPage();

}

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints =>

{

endpoints.MapControllers();

});

}

--

--

--

Full Stack Developer

Recommended from Medium

An Introduction to Nmap for Port Scanning and OS Detection

A Super-Easy Guide To Creating A Fieldtype In ExpressionEngine

A Super-Easy Guide To Creating A Fieldtype In ExpressionEngine

Observations running more than 5 million headless sessions a week

MRHB DeFi and Sukhavati Labs Partner to Bring Web3 to Excluded Communities

Rethinking Component Libraries

What is Extract, Transform, Load (ETL), and How Does it Work?

DashboardFox - Database Reporting Platform

Learn Python Modules and Packages in 5 Minutes

What Does the Future Hold for Next-Generation Cloud Database Technology in the Cloud Native Era?

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
ilhan DEMİRTEPE

ilhan DEMİRTEPE

Full Stack Developer

More from Medium

How to deploy your ASP.Net Core Web API on Heroku using Docker

Setting up self-signed SSL certificates for local development in WSL2

.NET Core

Keyed Dependency Injection using .NET