Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(function () {
mqttServer = mqtt.MqttServer(app.mqtt).listen(1883, function () {
});
});
db.find(payload, function (results) {
if (results.length > 0) {
db.update(data);
res.send({db: "update"});
} else {
db.insert(data);
res.send({db: "insert"});
}
});
});
app.listen(3000, function () {
console.log("server run on http://localhost:%d", 3000);
});
mqtt.MqttServer(mqttServer).listen(1883, function () {
console.log("mqtt server listening on port %d", 1883);
});
coap.createServer(coapServer).listen(5683, function () {
console.log("coap server listening on port %d", 5683);
});
if (_.include(app.config.get('modules'), 'websocket')) {
var webSocketServer = new WebSocketServer({port: config.get('port.websocket')});
app.websocket(webSocketServer);
console.log("websocket server listening on port %d", config.get('port.websocket'));
}
if (_.include(app.config.get('modules'), 'coap')) {
coap.createServer(app.coap).listen(config.get('port.coap'), function () {
console.log("coap server listening on port %d", config.get('port.coap'));
});
}
if (_.include(app.config.get('modules'), 'mqtt')) {
mqtt.MqttServer(app.mqtt).listen(config.get('port.mqtt'), function () {
console.log("mqtt server listening on port %d", config.get('port.mqtt'));
});
}
return app;
};