12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- const path = require('path');
- module.exports = (dbconfig) => {
- var RepositorySystem = require('../systems/RepositorySystem').setDB(dbconfig);
- var RoutingSystem = require('../systems/RoutingSystem');
- var AdminSystem = require('../systems/AdminSystem');
- var UserSystem = require('../systems/UserSystem');
- var ModuleSystem = require('../systems/ModuleSystem');
- var Filters = require('../modules/Filters/FilterService');
- var Mods = require('../modules/index.js');
- function loadApp(app) {
- ModuleSystem.loadModules(path.resolve(__dirname, "../modules"));
- ModuleSystem.run();
- app.use(UserSystem.Middleware);
- app.use(UserSystem.Middleware);
- app.use(Filters.Middleware);
- app.use(RoutingSystem.router);
- }
- function main(app) {
- ModuleSystem.loadModule(Mods.Users)
- ModuleSystem.loadModule(Mods.Account)
- ModuleSystem.loadModule(Mods.Globals)
- ModuleSystem.loadModule(Mods.Files)
- ModuleSystem.loadModule(Mods.Filters)
- ModuleSystem.run();
- app.use(UserSystem.Middleware);
- app.use(UserSystem.Middleware);
- app.use(Filters.Middleware);
- app.use(RoutingSystem.router);
- }
- const Systems = {
- RoutingSystem,
- RepositorySystem,
- AdminSystem,
- UserSystem,
- ModuleSystem,
- Filters
- }
- return {
- load: (app) => {
- loadApp(app);
- return Systems;
- },
- minimal: (app) => {
- main(app);
- return Systems;
- },
- Systems,
- Modules: Mods
- }
- };
|