2015-07-20 09:41:58 +00:00
|
|
|
"use strict";
|
|
|
|
|
2016-01-22 11:22:40 +00:00
|
|
|
const env = process.env.NODE_ENV || "development";
|
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
const express = require("express");
|
|
|
|
const app = express();
|
|
|
|
const server = require('http').Server(app);
|
|
|
|
const io = require('socket.io')(server);
|
|
|
|
const config = require(path.join(__dirname, "config/config.js"));
|
2015-10-01 12:40:47 +00:00
|
|
|
|
2016-01-22 11:22:40 +00:00
|
|
|
if (env === "production") require("newrelic");
|
2015-07-20 09:41:58 +00:00
|
|
|
|
2015-08-07 00:14:36 +00:00
|
|
|
// Load Models
|
|
|
|
require(path.join(__dirname, "db/index"));
|
|
|
|
|
2015-09-14 17:11:52 +00:00
|
|
|
// Initialise Steam Bot
|
2017-03-10 21:06:06 +00:00
|
|
|
//if (env !== "test") {
|
|
|
|
// require(path.join(__dirname, "lib/steam/bot"))(config.steamBot);
|
|
|
|
//}
|
2015-09-14 17:11:52 +00:00
|
|
|
|
2017-06-22 13:47:29 +00:00
|
|
|
//Initialise Discord Bot
|
2018-11-18 21:32:11 +00:00
|
|
|
// if (env !== "test") {
|
|
|
|
// require(path.join(__dirname, "lib/discord/bot"))(config.discordBot);
|
|
|
|
// }
|
2017-06-22 13:47:29 +00:00
|
|
|
|
2015-07-20 09:41:58 +00:00
|
|
|
// Configure express
|
|
|
|
require(path.join(__dirname, "config/express"))(app);
|
|
|
|
|
|
|
|
// Add routes
|
|
|
|
require(path.join(__dirname, "config/routes"))(app);
|
|
|
|
|
|
|
|
// Configure socket.io server
|
2016-01-22 11:22:40 +00:00
|
|
|
require(path.join(__dirname, "config/socketio"))(io);
|
2015-07-20 22:47:18 +00:00
|
|
|
|
|
|
|
server.listen(config.port);
|
2015-07-20 09:41:58 +00:00
|
|
|
console.log("Listening on port", config.port);
|
|
|
|
|
2015-07-20 22:47:18 +00:00
|
|
|
module.exports = {
|
|
|
|
app: app,
|
|
|
|
server: server,
|
|
|
|
io: io
|
2016-01-22 11:22:40 +00:00
|
|
|
};
|