influxdb.js 659 Bytes
/**
 *
 * @author: jiangfeng<jeff.jiang@yoho.cn>
 * @date: 2016/7/29
 */
'use strict';
const influx = require('influx');

let client = influx({
    hosts: [{
        host: '10.66.1.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;