2018-04-27 12:23:19 +00:00
|
|
|
// Config module
|
|
|
|
const Config = require('../Config/Config.js')
|
|
|
|
|
|
|
|
const mongoose = require('mongoose');
|
|
|
|
|
|
|
|
mongoose.connect(Config.mongoURL);
|
|
|
|
|
2018-04-28 14:44:33 +00:00
|
|
|
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
|
2018-04-28 14:44:33 +00:00
|
|
|
require("fs")
|
|
|
|
.readdirSync(normalizedPath)
|
|
|
|
.forEach((file) => {
|
|
|
|
Models[file.split('.')[0]] = require(normalizedPath + '/' + file);
|
|
|
|
});
|
2018-04-27 12:23:19 +00:00
|
|
|
|
|
|
|
const util = {
|
2018-04-28 14:44:33 +00:00
|
|
|
Models: Models
|
2018-04-27 12:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = util;
|