This commit is contained in:
2023-11-07 17:15:33 +08:00
commit fe37e2e1df
418 changed files with 53012 additions and 0 deletions
@@ -0,0 +1,26 @@
/**
* 自定义公共函数包
* 这里可以写你自己的公共函数
*/
var pubFun = {};
/**
* 公共函数写法示例
* 调用示例:
* pubFun.test();
* 或
* vk.myfn.test();
*/
pubFun.test = function(path) {
// 此处可以直接使用 vk 实例
let timeStr = vk.pubfn.timeFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
// 逻辑
// ...
// 逻辑
return {
timeStr,
msg: "这是公共函数test的返回"
}
}
module.exports = pubFun;
@@ -0,0 +1,15 @@
/**
* URL重写
*/
module.exports = {
"rule": {
// 示例1:https://xxx.bspapp.com/http/router/aaa 指向云函数 template/db_api/pub/select
"^aaa$": "template/db_api/pub/select",
// 示例2:https://xxx.bspapp.com/http/router/findById/001 指向云函数 template/db_api/pub/findById?_id=001
"^findById/(.+)": "template/db_api/pub/findById?_id=$1"
},
"config": {
// 当设置为true时,只有符合url重写规则内的云函数才可以被url化访问。
"accessOnlyInRule": false
}
};