12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 'use strict';
- process.env.NODE_CONFIG_DIR = `${__dirname}/config`;
- const async = require('async');
- const db = require('./logic/db');
- const app = require('./logic/app');
- const io = require('./logic/io');
- const stations = require('./logic/stations');
- const songs = require('./logic/songs');
- const cache = require('./logic/cache');
- const notifications = require('./logic/notifications');
- const config = require('config');
- async.waterfall([
-
- (next) => {
- cache.init(config.get('redis').url, () => {
-
-
- next();
- });
- },
-
- (next) => db.init(config.get("mongo").url, next),
-
- (next) => app.init(next),
-
- (next) => io.init(next),
-
- (next) => notifications.init(config.get('redis').url, next),
-
- (next) => stations.init(next),
-
- (next) => songs.init(next),
-
- (next) => {
- if (!config.get("isDocker")) {
- const express = require('express');
- const app = express();
- const server = app.listen(8080);
- app.use(express.static(__dirname + "/../frontend/build/"));
- }
- next();
- }
- ], (err) => {
- if (err && err !== true) {
- console.error('An error occurred while initializing the backend server');
- console.error(err);
- } else {
- console.info('Backend server has been successfully started');
- }
- });
|