This action will force synchronization from 阿妮亚/ReZero, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
qq群号:878157334
是一款.NET中间件,让你无需写任何代码也能实现CRUD,也可以发布成exe独立使用于非.NET用户
创建接口
界面建库、界面建表 、界面生成接口、界面设置授权、界面生成接口文档、界面调试接口、云端ORM 、超级API
查看创建后的接口
Sqlite 、 MySql 、 SqlServer 、 PgSQL 、Oracle 、人大金仓(默认模式)、 达梦
通过下载EXE运行 https://gitee.com/sunkaixuan/ReZero/releases/tag/1.0.0.16
Rezero.Api
新建一个.NET6+ WEB API 只需要注入一行代码就能使用 Rezero API
/***对现有代码没有任何影响***/
//注册:注册超级API服务
builder.Services.AddReZeroServices(api =>
{
//启用超级API
api.EnableSuperApi();//默认载体为sqlite ,有重载可以配置数据库
});
//写在builder.Build前面就行只需要一行
var app = builder.Build();
启动项目直接访问地址就行了 http://localhost:5267/rezero
//注册:注册超级API服务
builder.Services.AddReZeroServices(api =>
{
//启用超级API
api.EnableSuperApi(new SuperAPIOptions()
{
InterfaceOptions = new InterfaceOptions()
{
//授权拦截器
SuperApiAop = new JwtAop()
}
}); ;
});
public class JwtAop : DefaultSuperApiAop
{
public async override Task OnExecutingAsync(InterfaceContext aopContext)
{
//注意:html页面的url里面加token=xxx可以让内部接口也支持jwt授权
var authenticateResult = await aopContext.HttpContext.AuthenticateAsync(JwtBearerDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded)
{
throw new Expception("Unauthorized");
}
await base.OnExecutingAsync(aopContext);
}
}
界面配置ToKen
只要在url加上model=small 就会隐藏头部菜单和左边的菜单
如果跨域或者端口需要url加token这样可以让内部接口也支持jwt授权
效果图如下
如果不喜欢默认返回格式我们可以自定义返回格式
builder.Services.AddReZeroServices(api =>
{
api.EnableSuperApi(new SuperAPIOptions()
{
InterfaceOptions = new InterfaceOptions()
{
//MergeDataToStandardDtoFunc 设置统一返回格式
MergeDataToStandardDtoFunc = dto =>
{
if (dto is ErrorResponse error)
{
return new { isSuccess = false, data = error.message };
}
else if (dto is bool b)
{
return new { isSuccess = b, data = b };
}
//更多逻辑自已处理这儿只是一个示例
return new { isSuccess = true, data = dto };
}
}
});
});
首先感谢大家 , 项目启动前就有人赞助开发了
工作量很大 ,功能复杂 ,对标的是收费软件,相信未来将会成长的很好
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。