初始提交
This commit is contained in:
25
uniCloud-aliyun/cloudfunctions/router/util/pubFunction.js
Normal file
25
uniCloud-aliyun/cloudfunctions/router/util/pubFunction.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 自定义公共函数包
|
||||
* 这里可以写你自己的公共函数
|
||||
*/
|
||||
var pubFun = {};
|
||||
var vk;
|
||||
/**
|
||||
* 初始化,请勿删除此代码
|
||||
*/
|
||||
pubFun.init = function(util) {
|
||||
vk = util.vk;// 也可以通过 uniCloud.vk 获取 vk对象
|
||||
}
|
||||
/**
|
||||
* 公共函数写法示例
|
||||
* pubFun.test();
|
||||
*/
|
||||
pubFun.test = function(path) {
|
||||
// 逻辑
|
||||
// ...
|
||||
// 逻辑
|
||||
return "这是公共函数test的返回";
|
||||
}
|
||||
|
||||
|
||||
module.exports = pubFun;
|
||||
10
uniCloud-aliyun/cloudfunctions/router/util/urlrewrite.js
Normal file
10
uniCloud-aliyun/cloudfunctions/router/util/urlrewrite.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* URL重写
|
||||
* 如让 https://xxx.bspapp.com/http/router/aaa 指向云函数 template/db_api/pub/select
|
||||
*/
|
||||
module.exports = {
|
||||
"rule":{
|
||||
"^findById/(.+)": "template/db_api/pub/findById?_id=$1",
|
||||
"^aaa$": "template/db_api/pub/select"
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user