mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 14:20:06 +01:00
chore: add API documentation to swagger
This commit is contained in:
26
Program.cs
26
Program.cs
@@ -1,8 +1,10 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using QuotifyBE.Controllers;
|
||||
using QuotifyBE.Data;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -46,7 +48,29 @@ builder.Services.AddScoped<GeneralUseHelpers>();
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "Quotify API",
|
||||
Description = "An ASP.NET Core Web API for managing quotes",
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "Quotify project's production branch",
|
||||
Url = new Uri("https://quotify.7o7.cx")
|
||||
},
|
||||
License = new OpenApiLicense
|
||||
{
|
||||
Name = "AGPLv3",
|
||||
Url = new Uri("https://www.gnu.org/licenses/agpl-3.0.en.html")
|
||||
}
|
||||
});
|
||||
|
||||
// using System.Reflection;
|
||||
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user