ffffng/server/main.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

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', []);
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');
require('./utils/errorTypes');
require('./utils/resources');
2014-05-12 20:08:19 +02:00
require('./utils/strings');
require('./utils/urlBuilder');
2014-05-12 20:08:19 +02:00
2016-06-07 14:08:04 +02:00
require('./resources/frontendResource');
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');
require('./resources/monitoringResource');
2014-05-12 20:08:19 +02:00
2016-05-20 22:11:35 +02:00
require('./services/mailService');
require('./services/mailTemplateService');
2014-05-12 20:08:19 +02:00
require('./services/nodeService');
require('./services/monitoringService');
2014-05-12 20:08:19 +02:00
require('../shared/validation/constraints');
require('./validation/validator');
2014-05-12 20:08:19 +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...');
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
});