ffffng/server/main.js

33 lines
802 B
JavaScript
Raw Permalink 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';
(function () {
// Use graceful-fs instead of fs also in all libraries to have more robust fs handling.
const realFs = require('fs');
const gracefulFs = require('graceful-fs');
gracefulFs.gracefulify(realFs);
})();
2018-12-17 22:49:54 +01:00
const config = require('./config').config;
2014-05-12 20:08:19 +02:00
2018-12-17 22:49:54 +01:00
const Logger = require('./logger')
Logger.tag('main', 'startup').info('Server starting up...');
2018-12-17 22:49:54 +01:00
require('./db/database').init()
.then(() => {
Logger.tag('main').info('Initializing...');
2018-12-17 22:49:54 +01:00
const app = require('./app');
2016-05-24 16:40:57 +02:00
2018-12-17 22:49:54 +01:00
require('./jobs/scheduler').init();
require('./router').init();
2014-05-12 20:08:19 +02:00
2018-12-17 22:49:54 +01:00
app.listen(config.server.port, '::');
module.exports = app;
})
.catch(error => {
console.error('Could not init database: ', error);
process.exit(1);
2014-05-12 20:08:19 +02:00
});