This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Datastore = require('nedb'), | |
db = {}, | |
myId = require('./autoincrement'), //my autoincrement function: https://gist.github.com/jamilservicos/bbf838037475b7c4796373da6cee724d | |
dbfunc = {}; | |
db.mainDb = new Datastore({filename: 'data/maindb.db', autoload: true}); | |
dbfunc.insert = function insert(req, cb) { | |
const dbName = eval("db." + req.body.database + "Db"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Datastore = require('nedb'), | |
db = {}, | |
dbfunc = {}; | |
db.autoincrement = new Datastore({filename: 'data/autoincrement.db', autoload: true}); | |
dbfunc.autoId = function getUniqueId(nameDb, cb) { | |
db.autoincrement.findOne({name: nameDb}, function (err, doc) { | |
if (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var reconnection = true, | |
reconnectionDelay = 5000, | |
reconnectionTry = 0; | |
function initClient() { | |
connectClient(); | |
} |
NewerOlder