mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-13 19:52:50 +08:00
Add .NET 6 Sample
This commit is contained in:
parent
03ee5dadb0
commit
6bfc2dd266
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30330.147
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.31903.286
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{929BB2D7-C678-4BE8-8AA9-F271A2AE4545}"
|
||||
EndProject
|
||||
@ -9,11 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{75C51574-4
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Basic", "test\Basic\Basic.csproj", "{88972F96-96D7-40A7-90DA-ED04C9ED9B33}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{98C9AB6E-7179-4594-9703-BB0BB6D7949C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Knife4jUIDemo", "test\Knife4jUIDemo\Knife4jUIDemo.csproj", "{86A24FA0-E85D-4BDD-97D7-B990C50A40A9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{C146A419-15E0-4475-9623-706C5E2DCE0B}"
|
||||
@ -28,6 +23,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OAuth2Integration", "test\W
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Swagger.Knife4jUI", "test\WebSites\NSwag.Swagger.Knife4jUI\NSwag.Swagger.Knife4jUI.csproj", "{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore6Api", "samples\AspNetCore6Api\AspNetCore6Api.csproj", "{43B995C5-145B-4D46-B4C3-6340F31A1572}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A08844CF-E477-4104-98CB-EB6417CB1B0C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
LICENSE = LICENSE
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -58,6 +63,10 @@ Global
|
||||
{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{43B995C5-145B-4D46-B4C3-6340F31A1572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43B995C5-145B-4D46-B4C3-6340F31A1572}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43B995C5-145B-4D46-B4C3-6340F31A1572}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{43B995C5-145B-4D46-B4C3-6340F31A1572}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -70,6 +79,7 @@ Global
|
||||
{86851B6C-3504-4879-8464-1DB422D46BA0} = {75C51574-4CBD-403B-8182-8BF2A6DCFD43}
|
||||
{9E8D8F42-33F0-4F2D-9B56-1AB1B33DE1FA} = {86851B6C-3504-4879-8464-1DB422D46BA0}
|
||||
{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB} = {86851B6C-3504-4879-8464-1DB422D46BA0}
|
||||
{43B995C5-145B-4D46-B4C3-6340F31A1572} = {C146A419-15E0-4475-9623-706C5E2DCE0B}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9D77CCB4-F597-421B-9EF9-52D4B0AC382D}
|
||||
|
20
samples/AspNetCore6Api/AspNetCore6Api.csproj
Normal file
20
samples/AspNetCore6Api/AspNetCore6Api.csproj
Normal file
@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>AspNetCore6Api.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
121
samples/AspNetCore6Api/AspNetCore6Api.xml
Normal file
121
samples/AspNetCore6Api/AspNetCore6Api.xml
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>AspNetCore6Api</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:AspNetCore6Api.Controllers.WeatherForecastController">
|
||||
<summary>
|
||||
中文这是一个Get请求这是一个Get请求
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:AspNetCore6Api.Controllers.WeatherForecastController.GetErrorCode">
|
||||
<summary>
|
||||
得到一个ErrorCode
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:AspNetCore6Api.Controllers.WeatherForecastController.PostErrorCode(AspNetCore6Api.Controllers.PostErrorCodeDto)">
|
||||
<summary>
|
||||
发送一个Post
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:AspNetCore6Api.Controllers.WeatherForecastController.Get">
|
||||
<summary>
|
||||
这是一个Get请求
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:AspNetCore6Api.Controllers.PostErrorCodeDto">
|
||||
<summary>
|
||||
请求实体
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:AspNetCore6Api.Controllers.PostErrorCodeDto.Message">
|
||||
<summary>
|
||||
异常信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:AspNetCore6Api.Controllers.PostErrorCodeDto.ErrorCode">
|
||||
<summary>
|
||||
状态码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Knife4jUIDemo.ErrorCode">
|
||||
<summary>
|
||||
注释ErrorCode
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.Success">
|
||||
<summary>
|
||||
操作成功
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.UnknownError">
|
||||
<summary>
|
||||
未知错误
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.ServerUnknownError">
|
||||
<summary>
|
||||
服务器未知错误
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.Error">
|
||||
<summary>
|
||||
失败
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.AuthenticationFailed">
|
||||
<summary>
|
||||
认证失败
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.NoPermission">
|
||||
<summary>
|
||||
无权限
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.Fail">
|
||||
<summary>
|
||||
失败
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.RefreshTokenError">
|
||||
<summary>
|
||||
refreshToken异常
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.NotFound">
|
||||
<summary>
|
||||
资源不存在
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.ParameterError">
|
||||
<summary>
|
||||
参数错误
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.TokenInvalidation">
|
||||
<summary>
|
||||
令牌失效
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.TokenExpired">
|
||||
<summary>
|
||||
令牌过期
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.RepeatField">
|
||||
<summary>
|
||||
字段重复
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Knife4jUIDemo.ErrorCode.Inoperable">
|
||||
<summary>
|
||||
禁止操作
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
@ -0,0 +1,95 @@
|
||||
using Knife4jUIDemo;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AspNetCore6Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 中文这是一个Get请求这是一个Get请求
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/WeatherForecast/[action]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到一个ErrorCode
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ErrorCode GetErrorCode()
|
||||
{
|
||||
return ErrorCode.Success;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ErrorCode GetErrorCode2(ErrorCode errorCode)
|
||||
{
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetErrorCode4(ErrorCode errorCode)
|
||||
{
|
||||
return new JsonResult(new PostErrorCodeDto() { Message = "a", ErrorCode = errorCode });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送一个Post
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public PostErrorCodeDto PostErrorCode([FromBody] PostErrorCodeDto PostErrorCodeDto)
|
||||
{
|
||||
return PostErrorCodeDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 这是一个Get请求
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
var rng = new Random();
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = rng.Next(-20, 55),
|
||||
Summary = Summaries[rng.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求实体
|
||||
/// </summary>
|
||||
public class PostErrorCodeDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
public WeatherForecast WeatherForecast { get; set; }
|
||||
/// <summary>
|
||||
/// 状态码
|
||||
/// </summary>
|
||||
public ErrorCode ErrorCode { get; set; }
|
||||
}
|
||||
}
|
81
samples/AspNetCore6Api/ErrorCode.cs
Normal file
81
samples/AspNetCore6Api/ErrorCode.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Knife4jUIDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 注释ErrorCode
|
||||
/// </summary>
|
||||
public enum ErrorCode
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作成功
|
||||
/// </summary>
|
||||
Success = 0,
|
||||
/// <summary>
|
||||
/// 未知错误
|
||||
/// </summary>
|
||||
UnknownError = 1007,
|
||||
/// <summary>
|
||||
/// 服务器未知错误
|
||||
/// </summary>
|
||||
ServerUnknownError = 999,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
Error = 1000,
|
||||
|
||||
/// <summary>
|
||||
/// 认证失败
|
||||
/// </summary>
|
||||
AuthenticationFailed = 10000,
|
||||
/// <summary>
|
||||
/// 无权限
|
||||
/// </summary>
|
||||
NoPermission = 10001,
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
Fail = 9999,
|
||||
/// <summary>
|
||||
/// refreshToken异常
|
||||
/// </summary>
|
||||
RefreshTokenError = 10100,
|
||||
/// <summary>
|
||||
/// 资源不存在
|
||||
/// </summary>
|
||||
NotFound = 10020,
|
||||
/// <summary>
|
||||
/// 参数错误
|
||||
/// </summary>
|
||||
[Description("参数错误")]
|
||||
ParameterError = 10030,
|
||||
/// <summary>
|
||||
/// 令牌失效
|
||||
/// </summary>
|
||||
[Description("令牌失效")]
|
||||
TokenInvalidation = 10040,
|
||||
/// <summary>
|
||||
/// 令牌过期
|
||||
/// </summary>
|
||||
TokenExpired = 10050,
|
||||
/// <summary>
|
||||
/// 字段重复
|
||||
/// </summary>
|
||||
RepeatField = 10060,
|
||||
/// <summary>
|
||||
/// 禁止操作
|
||||
/// </summary>
|
||||
Inoperable = 10070,
|
||||
//10080 请求方法不允许
|
||||
|
||||
//10110 文件体积过大
|
||||
|
||||
//10120 文件数量过多
|
||||
|
||||
//10130 文件扩展名不符合规范
|
||||
|
||||
//10140 请求过于频繁,请稍后重试
|
||||
ManyRequests = 10140
|
||||
}
|
||||
}
|
44
samples/AspNetCore6Api/Program.cs
Normal file
44
samples/AspNetCore6Api/Program.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "API V1", Version = "v1" });
|
||||
var filePath = Path.Combine(System.AppContext.BaseDirectory, "AspNetCore6Api.xml");
|
||||
c.IncludeXmlComments(filePath, true);
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseKnife4UI(c =>
|
||||
{
|
||||
c.RoutePrefix = "k4"; // serve the UI at root
|
||||
c.SwaggerEndpoint("/v1/swagger.json", "V1 Docs");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapSwagger("/k4/{documentName}/swagger.json");
|
||||
});
|
||||
|
||||
app.Run();
|
31
samples/AspNetCore6Api/Properties/launchSettings.json
Normal file
31
samples/AspNetCore6Api/Properties/launchSettings.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:7480",
|
||||
"sslPort": 44309
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"AspNetCore6Api": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7030;http://localhost:5030",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
samples/AspNetCore6Api/WeatherForecast.cs
Normal file
13
samples/AspNetCore6Api/WeatherForecast.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace AspNetCore6Api
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
8
samples/AspNetCore6Api/appsettings.Development.json
Normal file
8
samples/AspNetCore6Api/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
samples/AspNetCore6Api/appsettings.json
Normal file
9
samples/AspNetCore6Api/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.11" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="6.1.4" />
|
||||
</ItemGroup>
|
||||
@ -16,6 +17,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />
|
||||
<!--<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />-->
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -55,7 +55,7 @@ namespace Basic
|
||||
//c.EnableAnnotations();
|
||||
c.AddServer(new OpenApiServer()
|
||||
{
|
||||
Url = "",
|
||||
Url = "http://localhost:81/admin/",
|
||||
Description = "vvv"
|
||||
});
|
||||
c.CustomOperationIds(apiDesc =>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!--<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.9" />-->
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -23,14 +23,19 @@ namespace Knife4jUIDemo
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
services.Configure<Knife4UIOptions>(c =>
|
||||
{
|
||||
Configuration.Bind("Knife4UI", c);
|
||||
});
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "API V1", Version = "v1" });
|
||||
c.AddServer(new OpenApiServer()
|
||||
{
|
||||
//Url = "http://localhost:81/admin/",
|
||||
Url = "http://localhost:81/admin/",
|
||||
Description = "vvv"
|
||||
});
|
||||
|
||||
c.CustomOperationIds(apiDesc =>
|
||||
{
|
||||
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||
|
@ -6,5 +6,9 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"Knife4UI": {
|
||||
"DocumentTitle": "Knife4jUI Demo"
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user