diff --git a/src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs b/src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs index 3859f51180..aca4f8ca56 100644 --- a/src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs +++ b/src/Volo.Abp.Identity.HttpApi.Host/AbpIdentityHttpApiHostModule.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Swashbuckle.AspNetCore.Swagger; using Volo.Abp.AspNetCore.Modularity; using Volo.Abp.Autofac; using Volo.Abp.Data; @@ -33,6 +34,13 @@ namespace Volo.Abp.Identity.HttpApi.Host }); services.AddMvc(); + + services.AddSwaggerGen(options => + { + options.SwaggerDoc("v1", new Info { Title = "Volo.Abp.Identity API", Version = "v1" }); + options.DocInclusionPredicate((docName, description) => true); + }); + services.AddAssemblyOf(); } @@ -47,7 +55,15 @@ namespace Volo.Abp.Identity.HttpApi.Host app.UseDeveloperExceptionPage(); } - app.UseMvc(); //No need to a default route + app.UseStaticFiles(); + + app.UseSwagger(); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "Volo.Abp.Identity API"); + }); + + app.UseMvcWithDefaultRoute(); } private static IConfigurationRoot BuildConfiguration(IHostingEnvironment env) diff --git a/src/Volo.Abp.Identity.HttpApi.Host/Controllers/HomeController.cs b/src/Volo.Abp.Identity.HttpApi.Host/Controllers/HomeController.cs new file mode 100644 index 0000000000..34283e4d36 --- /dev/null +++ b/src/Volo.Abp.Identity.HttpApi.Host/Controllers/HomeController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; + +namespace Volo.Abp.Identity.HttpApi.Host.Controllers +{ + public class HomeController : AbpController + { + public IActionResult Index() + { + return Redirect("/swagger"); + } + } +} diff --git a/src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.csproj b/src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.csproj index cb52e807b0..291fc63e8d 100644 --- a/src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.csproj +++ b/src/Volo.Abp.Identity.HttpApi.Host/Volo.Abp.Identity.HttpApi.Host.csproj @@ -23,6 +23,8 @@ + + @@ -34,6 +36,7 @@ +