1 Star 0 Fork 6

阿炳 / rocket-open-api

forked from 食得落 / rocket-open-api 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 904 Bytes
一键复制 编辑 原始数据 按行查看 历史
食得落 提交于 2021-05-18 19:54 . add README.md.

rocket-open-api

Description

基于rocket-api实现的开放平台,实现代理接口的鉴权,熔断,限流,缓存,请求与返回改写,网关等功能,以及分布式环境下的接口动态管理,不需要重启服务

rocket语法

//鉴权
//Utils.loadAPI("GET:/cgi-bin/token/validate")

route.init()

.limiter(5,2)   //限流,熔断.每5秒中允许请求2次

.cacheTime(10)    //接口缓存10秒

.requestHeader({item->["masterId":"111"]}) //请求header重写

.requestBody({item->["hello":"hello"]}) //请求体改写

.requestMethod("POST")  //请求方法重写

.to("http://localhost:8080/user/list") //请求地址重写

.responseBody({item->item.data.userId="555";return item.data; })//返回实体改写

.responseHeader({item->     //返回header改写
    item.masterId = "123";
    return item;
})
.done();
1
https://gitee.com/brantliu/rocket-open-api.git
git@gitee.com:brantliu/rocket-open-api.git
brantliu
rocket-open-api
rocket-open-api
master

搜索帮助