2016-06-11 16:27:23 +02:00
|
|
|
#!/usr/bin/env node
|
2014-05-12 20:08:19 +02:00
|
|
|
/*jslint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Dirty hack to allow usage of angular modules.
|
2016-05-16 13:33:49 +02:00
|
|
|
global.angular = require('ng-di');
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
angular.module('ffffng', []);
|
|
|
|
|
2016-06-21 22:59:37 +02:00
|
|
|
(function () {
|
|
|
|
// Use graceful-fs instead of fs also in all libraries to have more robust fs handling.
|
|
|
|
var realFs = require('fs');
|
|
|
|
var gracefulFs = require('graceful-fs');
|
|
|
|
gracefulFs.gracefulify(realFs);
|
|
|
|
})();
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./config');
|
|
|
|
|
2016-05-24 16:40:57 +02:00
|
|
|
require('./logger').tag('main', 'startup').info('Server starting up...');
|
|
|
|
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./app');
|
|
|
|
require('./router');
|
|
|
|
require('./libs');
|
|
|
|
|
2016-06-26 19:09:12 +02:00
|
|
|
require('./utils/databaseUtil');
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./utils/errorTypes');
|
2016-05-18 22:50:06 +02:00
|
|
|
require('./utils/resources');
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./utils/strings');
|
2016-05-21 17:06:24 +02:00
|
|
|
require('./utils/urlBuilder');
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-06-26 20:21:45 +02:00
|
|
|
require('./resources/versionResource');
|
2016-07-19 13:24:43 +02:00
|
|
|
require('./resources/statisticsResource');
|
2016-06-07 14:08:04 +02:00
|
|
|
require('./resources/frontendResource');
|
2016-06-03 23:42:17 +02:00
|
|
|
require('./resources/taskResource');
|
2016-06-11 12:08:50 +02:00
|
|
|
require('./resources/mailResource');
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./resources/nodeResource');
|
2016-05-18 22:50:06 +02:00
|
|
|
require('./resources/monitoringResource');
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-20 22:11:35 +02:00
|
|
|
require('./services/mailService');
|
2016-06-11 12:32:20 +02:00
|
|
|
require('./services/mailTemplateService');
|
2014-05-12 20:08:19 +02:00
|
|
|
require('./services/nodeService');
|
2016-05-18 22:50:06 +02:00
|
|
|
require('./services/monitoringService');
|
2014-05-12 20:08:19 +02:00
|
|
|
|
|
|
|
require('../shared/validation/constraints');
|
2014-06-06 18:24:40 +02:00
|
|
|
require('./validation/validator');
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-21 17:06:24 +02:00
|
|
|
require('./jobs/scheduler');
|
|
|
|
|
|
|
|
var db = require('./db/database');
|
|
|
|
|
|
|
|
db.init(function () {
|
2016-05-24 16:40:57 +02:00
|
|
|
angular.injector(['ffffng']).invoke(function (config, app, Logger, Scheduler, Router) {
|
|
|
|
Logger.tag('main').info('Initializing...');
|
|
|
|
|
2016-05-21 17:06:24 +02:00
|
|
|
Scheduler.init();
|
2016-05-20 22:11:35 +02:00
|
|
|
Router.init();
|
2014-05-12 20:08:19 +02:00
|
|
|
|
2016-05-20 22:11:35 +02:00
|
|
|
app.listen(config.server.port, '::');
|
|
|
|
module.exports = app;
|
|
|
|
});
|
2014-05-12 20:08:19 +02:00
|
|
|
});
|