influxdb.js
640 Bytes
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 2016/7/29
*/
const influx = require('influx');
let client = influx({
hosts: [{
host: '54.222.219.223',
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;