mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-14 17:00:32 +00:00
79be2b8155
* Updated dependencies - React update needed transformation of React.createClass to ES2015 classes - removed some deprecations/deprecated packages - added mulitple @types Dependencies to devDependencies for IDE code completion support * added Docker related files - Dockerfile with build container - docker-compose.yml with mongodb and app
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
"use strict";
|
|
|
|
var path = require("path");
|
|
var winston = require("winston");
|
|
var mongoose = require("mongoose");
|
|
var config = require(path.join(__dirname, "../config/config.js"));
|
|
|
|
var connect = function () {
|
|
mongoose.connect(config.mongo.uri, {
|
|
useNewUrlParser: true,
|
|
useUnifiedTopology: true
|
|
}).then(
|
|
() => winston.info("MongoDB: Connection established"),
|
|
error => winston.error(error)
|
|
);
|
|
};
|
|
|
|
connect();
|
|
|
|
mongoose.connection.on("error", (error) => winston.error(error));
|
|
mongoose.connection.on("disconnected", () => winston.error("MongoDB: Was disconnected."));
|
|
mongoose.connection.on("reconnectFailed", () => winston.error("MongoDB: Reconnect Failed!"));
|
|
|
|
mongoose.connection.on("reconnected", () => winston.info("MongoDB: Connection established"));
|
|
|
|
// Load models
|
|
require(path.join(__dirname, "/models/event"));
|
|
require(path.join(__dirname, "/models/message"));
|
|
require(path.join(__dirname, "/models/session"));
|
|
require(path.join(__dirname, "/models/profile"));
|
|
require(path.join(__dirname, "/models/archivedGather"));
|
|
|
|
module.exports = mongoose;
|