mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 02:19:08 +00:00
chore: prettier on server
This commit is contained in:
parent
3b0d249e41
commit
912b40c383
21 changed files with 589 additions and 501 deletions
|
@ -1,36 +1,38 @@
|
|||
const log = new (require('./logger'))('Roleypoly')
|
||||
const Sequelize = require('sequelize')
|
||||
const fetchModels = require('./models')
|
||||
const fetchApis = require('./api')
|
||||
const log = new (require('./logger'))('Roleypoly');
|
||||
const Sequelize = require('sequelize');
|
||||
const fetchModels = require('./models');
|
||||
const fetchApis = require('./api');
|
||||
|
||||
class Roleypoly {
|
||||
constructor (router, io, app) {
|
||||
this.router = router
|
||||
this.io = io
|
||||
this.ctx = {}
|
||||
constructor(router, io, app) {
|
||||
this.router = router;
|
||||
this.io = io;
|
||||
this.ctx = {};
|
||||
|
||||
this.ctx.config = {
|
||||
appUrl: process.env.APP_URL
|
||||
}
|
||||
appUrl: process.env.APP_URL,
|
||||
};
|
||||
|
||||
this.ctx.io = io
|
||||
this.__app = app
|
||||
this.ctx.io = io;
|
||||
this.__app = app;
|
||||
|
||||
if (log.debugOn) log.warn('debug mode is on')
|
||||
if (log.debugOn) log.warn('debug mode is on');
|
||||
|
||||
this.__initialized = this._mountServices()
|
||||
this.__initialized = this._mountServices();
|
||||
}
|
||||
|
||||
async awaitServices () {
|
||||
await this.__initialized
|
||||
async awaitServices() {
|
||||
await this.__initialized;
|
||||
}
|
||||
|
||||
async _mountServices () {
|
||||
const sequelize = new Sequelize(process.env.DB_URL, { logging: log.sql.bind(log, log) })
|
||||
this.ctx.sql = sequelize
|
||||
this.M = fetchModels(sequelize)
|
||||
this.ctx.M = this.M
|
||||
await sequelize.sync()
|
||||
async _mountServices() {
|
||||
const sequelize = new Sequelize(process.env.DB_URL, {
|
||||
logging: log.sql.bind(log, log),
|
||||
});
|
||||
this.ctx.sql = sequelize;
|
||||
this.M = fetchModels(sequelize);
|
||||
this.ctx.M = this.M;
|
||||
await sequelize.sync();
|
||||
|
||||
// this.ctx.redis = new (require('ioredis'))({
|
||||
// port: process.env.REDIS_PORT || '6379',
|
||||
|
@ -40,16 +42,16 @@ class Roleypoly {
|
|||
// enableReadyCheck: true,
|
||||
// enableOfflineQueue: true
|
||||
// })
|
||||
this.ctx.server = new (require('./services/server'))(this.ctx)
|
||||
this.ctx.discord = new (require('./services/discord'))(this.ctx)
|
||||
this.ctx.sessions = new (require('./services/sessions'))(this.ctx)
|
||||
this.ctx.P = new (require('./services/presentation'))(this.ctx)
|
||||
this.ctx.server = new (require('./services/server'))(this.ctx);
|
||||
this.ctx.discord = new (require('./services/discord'))(this.ctx);
|
||||
this.ctx.sessions = new (require('./services/sessions'))(this.ctx);
|
||||
this.ctx.P = new (require('./services/presentation'))(this.ctx);
|
||||
}
|
||||
|
||||
async mountRoutes () {
|
||||
fetchApis(this.router, this.ctx)
|
||||
this.__app.use(this.router.middleware())
|
||||
async mountRoutes() {
|
||||
fetchApis(this.router, this.ctx);
|
||||
this.__app.use(this.router.middleware());
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Roleypoly
|
||||
module.exports = Roleypoly;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue