framez-server/Server/Utils/DBUtil.js

24 lines
479 B
JavaScript
Raw Normal View History

2018-04-27 12:23:19 +00:00
// Config module
const Config = require('../Config/Config.js')
const mongoose = require('mongoose');
mongoose.connect(Config.mongoURL);
const Models = {}
2018-04-27 12:23:19 +00:00
var normalizedPath = require("path").join(__dirname, "..", "Schemas");
// Load All Schemas and put them in Shemas Obj
require("fs")
.readdirSync(normalizedPath)
.forEach((file) => {
Models[file.split('.')[0]] = require(normalizedPath + '/' + file);
});
2018-04-27 12:23:19 +00:00
const util = {
Models: Models
2018-04-27 12:23:19 +00:00
}
module.exports = util;