推广您的产品

外观
API网关:Yarp Gateway
更多功能请参考Yarp官方文档
dotnet new install ZhonTai.Template.Gateway
升级模板命令和安装模板命令相同
dotnet new install ZhonTai.Template.Gateway::9.0.2
dotnet new MyGateway -h
-p, --port <port> Port settings
类型: int
默认: 16010
dotnet new uninstall ZhonTai.Template.Gateway
dotnet new MyGateway -n MyCompanyName.MyGateway
dotnet new MyGateway -n MyCompanyName.MyGateway -p 16010
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Urls": "http://*:16010",
"ReverseProxy": {
"Routes": {
"admin": {
"ClusterId": "admin",
"Match": {
"Path": "/api/admin/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
},
"admin-doc": {
"ClusterId": "admin",
"Match": {
"Path": "/doc/admin/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
},
"biz": {
"ClusterId": "biz",
"Match": {
"Path": "/api/biz/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
},
"biz-doc": {
"ClusterId": "biz",
"Match": {
"Path": "/doc/biz/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
},
"mem": {
"ClusterId": "mem",
"Match": {
"Path": "/api/mem/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
},
"mem-doc": {
"ClusterId": "mem",
"Match": {
"Path": "/doc/mem/{**catch-all}",
//"Methods": [ "POST", "GET", "DELETE", "PUT" ],
"Hosts": []
}
}
},
"Clusters": {
"admin": {
"Destinations": {
"destination1": {
"Address": "http://localhost:18010"
}
},
"LoadBalancingPolicy": "RoundRobin"
},
"biz": {
"Destinations": {
"destination1": {
"Address": "http://localhost:18020"
}
},
"LoadBalancingPolicy": "RoundRobin"
},
"mem": {
"Destinations": {
"destination1": {
"Address": "http://localhost:18030"
}
},
"LoadBalancingPolicy": "RoundRobin"
}
}
},
//网关配置
"GatewayConfig": {
//模块列表
"ModuleList": [
{
//文档名称
"Name": "admin权限接口文档",
//文档地址
"Url": "/doc/admin/index.html"
},
{
"Name": "biz业务接口文档",
"Url": "/doc/biz/index.html"
},
{
"Name": "mem会员接口文档",
"Url": "/doc/mem/index.html"
}
],
//健康检查
"HealthChecks": {
//启用
"Enable": true,
//访问路径
"Path": "/health"
}
}
}
{
"profiles": {
"MyGateway.Host": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:16010"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:16010",
"sslPort": 0
}
}
}