【发布时间】:2017-02-17 21:48:39
【问题描述】:
我第一次使用 express 也是 node.js 。我正在使用 API(第三方)。我知道如何使用module.exports 将函数从一个文件调用到另一个文件。但是我怎么能调用下面格式编写的 API:
var taobao = require('taobao');
taobao.config({
app_key: 'xxxxx',
app_secret: 'xxxxxxxx',
REST_URL: 'http://gw.api.taobao.com/router/rest'
});
taobao.core.call({
"session": '620260160ZZ61473fc31270',
"method": "taobao.wlb.imports.waybill.get",
"format": "json",
"tid": 21132213,
"order_code": 'lp number',//This we have to pass.
}, function (data) {
console.log(data);
});
我想在不同的文件中调用上述 API。我应该为此使用模块导出吗?或者有没有其他办法?
【问题讨论】: