diff --git a/EstusShots.Server/EstusShots.Server.csproj b/EstusShots.Server/EstusShots.Server.csproj
index 58e143c..f793bf3 100644
--- a/EstusShots.Server/EstusShots.Server.csproj
+++ b/EstusShots.Server/EstusShots.Server.csproj
@@ -19,6 +19,7 @@
+
diff --git a/EstusShots.Server/Startup.cs b/EstusShots.Server/Startup.cs
index 41ec82e..5689e89 100644
--- a/EstusShots.Server/Startup.cs
+++ b/EstusShots.Server/Startup.cs
@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
+using Microsoft.OpenApi.Models;
namespace EstusShots.Server
{
@@ -34,6 +34,10 @@ namespace EstusShots.Server
options.JsonSerializerOptions.WriteIndented = true;
}
});
+ services.AddSwaggerGen(options =>
+ {
+ options.SwaggerDoc("v1", new OpenApiInfo { Title = "Estus Shots API", Version = "v1" });
+ });
services.AddScoped();
}
@@ -49,10 +53,18 @@ namespace EstusShots.Server
{
app.UseHttpsRedirection();
}
-
+ // Enable middleware to serve generated Swagger as a JSON endpoint.
+ app.UseSwagger();
+
+ // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
+ // specifying the Swagger JSON endpoint.
+ app.UseSwaggerUI(c =>
+ {
+ c.SwaggerEndpoint("/swagger/v1/swagger.json", "Estus Shots API V1");
+ });
+
app.UseRouting();
app.UseAuthorization();
-
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}