influxdb.js
639 Bytes
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 2016/7/29
*/
const influx = require('influx');
let client = influx({
hosts: [{
host: '172.31.56.150',
port: 8086,
protocol: 'http'
}],
database: 'udp'
});
const db = {
client: client,
query: (query) => {
console.log(query);
return new Promise((resolve, reject) => {
client.query(query, (err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
}
};
module.exports = db;