1.0.3 • Published 6 years ago

common-route-util v1.0.3

Weekly downloads
3
License
AGPL-3.0
Repository
github
Last release
6 years ago

node-common-route-util APLGv3开源协议

1. 如何使用node-common-route-util

执行命令 npm i common-route-util --save

文件一

class TestFunction{
  getUser(){
    console.log(2);
    return "zhangj";
  }
}
module.exports = TestFunction;

文件二

var Route = require("common-route-util");
var route = new Route({
   "getUser":{
     require:"./test/TestFunction.js",
     method:"getUser",
   }
});
let data = route.call("getUser",{
});
console.log(data);  

注意Route的参数为{}类型key表示调用的字符串
require 表示引入文件的地址
method 表示要调用的方法

注意模块需要module.exports导出以后才能在require中配置

作者声明-此版本不在进行更新,最后终结版本1.0.3