From d4390608e3c248e2002d7eff94a49c0e706b05f6 Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Mon, 14 Dec 2020 08:53:42 +0200 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=94=A8=20Change=20dev.js=20to=20keys.j?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need at the moment for multiple key files. --- server/actions/influx_actions.js | 4 ++-- server/config/keys.js | 10 ++++++++++ server/index.js | 12 +++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 server/config/keys.js diff --git a/server/actions/influx_actions.js b/server/actions/influx_actions.js index 5b6e875..44c7e54 100644 --- a/server/actions/influx_actions.js +++ b/server/actions/influx_actions.js @@ -1,8 +1,8 @@ const {Point} = require('@influxdata/influxdb-client'); const chalk = require('chalk') -const {writeApi, queryApi} = require('../connections/db_conn') -const {bucket} = require('../config/dev') +const {writeApi, queryApi} = require('../connections/influx_conn') +const {bucket} = require('../config/keys') write = (pointName, uuid, measurement) => { const point = new Point(pointName) diff --git a/server/config/keys.js b/server/config/keys.js new file mode 100644 index 0000000..21957a8 --- /dev/null +++ b/server/config/keys.js @@ -0,0 +1,10 @@ +module.exports = { + influx_url: 'http://0.0.0.0', + influx_token: '', + influx_org: '', + influx_bucket: '', + redis_user: '', + redis_password: '', + redis_host: '0.0.0.0', + redis_port: '7001' +} \ No newline at end of file diff --git a/server/index.js b/server/index.js index 8fc9ace..902fb4c 100644 --- a/server/index.js +++ b/server/index.js @@ -1,8 +1,14 @@ -const express = require('express') -const app = express() +const app = require('express')() +const server = require('http').createServer(app); +const chalk = require('chalk') + +const redis = require('./connections/redis_conn') +const influx = require('./connections/influx_conn') +const socket = require('./services/socket')(server) const measurementRoute = require('./routes/data') app.use(measurementRoute) -module.exports = app; +server.listen(3000); +console.log(chalk.green.bold('Server listening on port 3000!')); \ No newline at end of file