Created the app.js
This commit is contained in:
parent
5474ce5766
commit
05aa7df7e2
22
app.js
22
app.js
@ -0,0 +1,22 @@
|
|||||||
|
const mongoose = require('mongoose');
|
||||||
|
const socketServer = require('./server/socket');
|
||||||
|
const expressServer = require('./server/api');
|
||||||
|
const downloadServer = require('./server/download');
|
||||||
|
const mediaServer = require('./server/media');
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
// Connect to the database
|
||||||
|
mongoose.connect(process.env.MONGOOSE_STRING, (e) => {
|
||||||
|
if (!e) {
|
||||||
|
console.log("Successfully connected to the database");
|
||||||
|
start();
|
||||||
|
} else console.error("Could not connect to the database: " + e.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Starts all servers
|
||||||
|
const start = () => {
|
||||||
|
expressServer.startServer(process.env.EXPRESS_PORT || 8352);
|
||||||
|
socketServer.startServer(process.env.SOCKET_PORT || 8353);
|
||||||
|
mediaServer.startServer(process.env.MEIDA_PORT || 8354);
|
||||||
|
downloadServer.startServer(process.env.DOWNLOAD_PORT || 8355, process.env.RELEASE_PATH || "/mnt/data/download");
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user