|
|
@ -4,7 +4,6 @@ var pathmodule = require("path"); |
|
|
|
var app = require("express")(); |
|
|
|
var http = require("http").Server(app); |
|
|
|
var https = require("https"); |
|
|
|
const mongoose = require("mongoose"); |
|
|
|
var CONFIG = require(pathmodule.resolve(__dirname, "runconfig.js")); |
|
|
|
const io = require("socket.io")(http, { |
|
|
|
// pingTimeout: 30000,
|
|
|
@ -102,7 +101,10 @@ app.get("/length", cors(corsOptions), (req, res) => { |
|
|
|
|
|
|
|
var url = "mongodb://mongo:27017/"; |
|
|
|
|
|
|
|
MongoClient.connect(url, function (err, db) { |
|
|
|
MongoClient.connect( |
|
|
|
url, |
|
|
|
{ useNewUrlParser: true, useUnifiedTopology: true }, |
|
|
|
function (err, db) { |
|
|
|
if (err) throw err; |
|
|
|
var dbo = db.db("fluentdb"); |
|
|
|
dbo |
|
|
@ -161,7 +163,8 @@ app.get("/length", cors(corsOptions), (req, res) => { |
|
|
|
res.json(RES.data); |
|
|
|
db.close(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
// Lefos - mongo test read
|
|
|
@ -170,7 +173,10 @@ app.get("/test", cors(corsOptions), (req, res) => { |
|
|
|
|
|
|
|
var url = "mongodb://mongo:27017/"; |
|
|
|
|
|
|
|
MongoClient.connect(url, function (err, db) { |
|
|
|
MongoClient.connect( |
|
|
|
url, |
|
|
|
{ useNewUrlParser: true, useUnifiedTopology: true }, |
|
|
|
function (err, db) { |
|
|
|
if (err) throw err; |
|
|
|
var dbo = db.db("fluentdb"); |
|
|
|
dbo |
|
|
@ -202,7 +208,8 @@ app.get("/test", cors(corsOptions), (req, res) => { |
|
|
|
res.json(RES.data); |
|
|
|
db.close(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
app.get("/test2", cors(corsOptions), (req, res) => { |
|
|
@ -219,7 +226,10 @@ app.get("/test2", cors(corsOptions), (req, res) => { |
|
|
|
|
|
|
|
var url = "mongodb://mongo:27017/"; |
|
|
|
var jsonfinal = []; |
|
|
|
MongoClient.connect(url, function (err, db) { |
|
|
|
MongoClient.connect( |
|
|
|
url, |
|
|
|
{ useNewUrlParser: true, useUnifiedTopology: true }, |
|
|
|
function (err, db) { |
|
|
|
if (err) throw err; |
|
|
|
var dbo = db.db("fluentdb"); |
|
|
|
dbo |
|
|
@ -354,7 +364,8 @@ app.get("/test2", cors(corsOptions), (req, res) => { |
|
|
|
res.json(RES.data); |
|
|
|
db.close(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
console.log("reading from db...."); |
|
|
@ -757,11 +768,15 @@ async function checkstream(data) { |
|
|
|
console.log("Creating Stream...."); |
|
|
|
|
|
|
|
var url = "mongodb://mongo:27017/"; |
|
|
|
MongoClient.connect(url, function (err, db) { |
|
|
|
MongoClient.connect( |
|
|
|
url, |
|
|
|
{ useNewUrlParser: true, useUnifiedTopology: true }, |
|
|
|
function (err, db) { |
|
|
|
if (err) throw err; |
|
|
|
var dbo = db.db("fluentdb"); |
|
|
|
dbo.collection("test", onCollectionNew.bind(data)); |
|
|
|
}); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
// ***************************************************
|
|
|
|