opt:{
"protocol":"协议类型,默认:http",
"hostname":"主机名,例如:localhost、192.168.0.123 ...,默认:null",
"port":"端口,默认:4349",
"pathname":"接口路径,默认:report",
"url":"完整接口地址,默认:null",
"org":"组织名称",
"ds":"数据源名称",
"app":"注册app名称",
"auth":"app密钥"
}
opt.hostname 和 opt.url 只要指定一个
//npm install datareporter
var Reporter = require('datareporter');
var reporter = new Reporter({
org : 'acmoba',
ds : 'gamereport',
app : 'gamereporter',
auth : '123',
hostname: 'localhost'
});
var gr = {kill:1,death:1};
reporter.report(gr, function (err, rs) {
console.log(err, rs);
});