Skip to content

Instantly share code, notes, and snippets.

@tugcearar
Last active September 4, 2018 13:07
Show Gist options
  • Save tugcearar/340c0150263dabc3c288ed241bddce9a to your computer and use it in GitHub Desktop.
Save tugcearar/340c0150263dabc3c288ed241bddce9a to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
//Helper için
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Version = "v1",
Title = "My Web API",
Description = "Awesome WEB API",
TermsOfService = "None",
});
//Eğer servisimizde herhangi bir Authorization yapısı kullandıysak belirtiyoruz
c.AddSecurityDefinition("Bearer", new ApiKeyScheme
{
Description = "Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
In = "header",
Type = "apiKey"
});
// Swagger JSON ve UI'ında görünecek yorumların çekileceği xml dosyasını belirtiyoruz.
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "SwaggerSample.xml"));
});
services.AddMvc();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment