Xunet.MiniApi
1.0.2
dotnet add package Xunet.MiniApi --version 1.0.2
NuGet\Install-Package Xunet.MiniApi -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xunet.MiniApi" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xunet.MiniApi" Version="1.0.2" />
<PackageReference Include="Xunet.MiniApi" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xunet.MiniApi --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xunet.MiniApi, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Xunet.MiniApi&version=1.0.2
#tool nuget:?package=Xunet.MiniApi&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xunet.MiniApi
���������.NET ��СAPI֧�֣�������������
- ͳһ�Ľӿ���Ӧ��ʽ����
- �Զ����쳣��������ݳ־û�
- �Զ����������м��
- ����ǩ���м��
- ���ý������
- ����System.Text.Json�����л��ͷ����л�
- ֧��Sqlite��MySql��SqlServer���ݿ�
- Swagger�ӿ��ĵ�
- �����Զ���֤
- ��֤����Ȩ
- ������������������Ȩ
Support .NET 8.0+
��װ
Xunet.MiniApi �� NuGet ������ʽ�ṩ��������ʹ�� NuGet ������̨���ڰ�װ����
PM> Install-Package Xunet.MiniApi
ʹ��
Program.cs
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddXunetCache();
builder.Services.AddXunetJsonOptions();
builder.Services.AddXunetFluentValidation();
builder.Services.AddXunetHttpContextAccessor();
builder.Services.AddXunetHealthChecks();
builder.Services.AddXunetSwagger();
builder.Services.AddXunetSqliteStorage();
builder.Services.AddXunetJwtAuth();
builder.Services.AddXunetCors();
builder.Services.AddXunetRateLimiter();
builder.Services.AddXunetEventHandler();
builder.Services.AddXunetAuthorizationHandler();
builder.Services.AddXunetMapper();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseXunetCustomException();
app.UseXunetRequestHandler();
app.UseXunetHttpContextAccessor();
app.UseXunetHealthChecks();
app.UseXunetSwagger();
app.UseXunetStorage();
app.UseXunetAuthentication();
app.UseXunetCors();
app.UseRateLimiter();
// Configure the MiniApi request pipeline.
app.Run();
PermissionHandler.cs
public class PermissionHandler : AuthorizationHandler<PermissionRequirement>
{
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement)
{
if (context.User.Identity != null && context.User.Identity.IsAuthenticated)
{
// ����֤����Ȩ
await Task.CompletedTask;
context.Succeed(requirement);
}
else
{
context.Fail();
}
}
}
appsettings.Development.json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://0.0.0.0:8000"
},
"Http2": {
"Url": "http://0.0.0.0:8080",
"Protocols": "Http2"
}
}
},
"CorsHosts": [],
"ConnectionStrings": {
"DefaultConnection": "server=127.0.0.1;uid=root;pwd=root;database=miniapi;max pool size=8000;Charset=utf8;SslMode=none;Allow User Variables=True;",
"RedisConnection": "127.0.0.1:6379"
},
"JwtConfig": {
"ValidateIssuer": true,
"ValidIssuer": "miniapi",
"ValidateIssuerSigningKey": true,
"SymmetricSecurityKey": "294c66d31f8c4ec0b243bb7479cc38e0",
"ValidateAudience": true,
"ValidAudience": "manager",
"ValidateLifetime": true,
"RequireExpirationTime": true,
"ClockSkew": 1,
"RefreshTokenAudience": "manager",
"Expire": 2592000,
"RefreshTokenExpire": 10080
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Aliyun.OSS.SDK.NetCore (>= 2.14.1)
- AutoMapper (>= 13.0.1)
- Caching.CSRedis (>= 3.8.800)
- FluentValidation.AspNetCore (>= 11.3.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.8)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.AspNetCore.OpenApi (>= 8.0.8)
- OpenIddict.AspNetCore (>= 6.3.0)
- SqlSugarCore (>= 5.1.4.169)
- Swashbuckle.AspNetCore (>= 6.7.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.