Skip to content

Commit e010078

Browse files
committed
Merge branch 'netcore2.0-2' of https://github.com/aspnetboilerplate/module-zero-core-template into netcore2.0-2
2 parents c4183bf + 0fc5c2b commit e010078

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/wwwroot/swagger/ui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<script src='lang/ru.js' type='text/javascript'></script>
3232
<script src='lang/en.js' type='text/javascript'></script>
3333
<script src='lang/zh-cn.js' type='text/javascript'></script>-->
34-
34+
3535
<script type="text/javascript">
3636
$(function () {
3737
hljs.configure({

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/AbpCompanyName.AbpProjectName.Web.Mvc.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<PackageReference Include="Abp.RedisCache" Version="3.0.0-beta3" />
5656
<PackageReference Include="Abp.Castle.Log4Net" Version="3.0.0-beta3" />
5757
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.0.0" PrivateAssets="All" />
58+
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
5859
</ItemGroup>
5960

6061
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Startup/Startup.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using Microsoft.Extensions.Logging;
1515
using Microsoft.AspNetCore.Authentication;
1616
using Microsoft.AspNetCore.Authentication.JwtBearer;
17+
using Swashbuckle.AspNetCore.Swagger;
1718

1819
#if FEATURE_SIGNALR
1920
using Owin;
@@ -45,6 +46,12 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
4546

4647
services.AddScoped<IWebResourceManager, WebResourceManager>();
4748

49+
services.AddSwaggerGen(options =>
50+
{
51+
options.SwaggerDoc("v1", new Info { Title = "AbpZeroTemplate API", Version = "v1" });
52+
options.DocInclusionPredicate((docName, description) => true);
53+
});
54+
4855
//Configure Abp and Dependency Injection
4956
return services.AddAbp<AbpProjectNameWebMvcModule>(options =>
5057
{
@@ -73,6 +80,13 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
7380
app.UseAuthentication();
7481
app.UseJwtTokenMiddleware();
7582

83+
app.UseSwagger();
84+
//Enable middleware to serve swagger - ui assets(HTML, JS, CSS etc.)
85+
app.UseSwaggerUI(options =>
86+
{
87+
options.SwaggerEndpoint("/swagger/v1/swagger.json", "AbpZeroTemplate API V1");
88+
}); //URL: /swagger
89+
7690
#if FEATURE_SIGNALR
7791
//Integrate to OWIN
7892
app.UseAppBuilder(ConfigureOwinServices);

0 commit comments

Comments
 (0)