mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-29 07:32:14 +00:00
ddb6c460ff
* use ES Modules * Fix some bugs * add Novice Gather
30 lines
913 B
JavaScript
30 lines
913 B
JavaScript
import winston from "winston"
|
|
import mongoose from "mongoose";
|
|
import config from "../config/config.mjs";
|
|
|
|
mongoose.set('strictQuery', true);
|
|
|
|
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
|
|
import "./models/event.mjs";
|
|
import "./models/message.mjs";
|
|
import "./models/session.mjs";
|
|
import "./models/profile.mjs";
|
|
import "./models/archivedGather.mjs";
|