ensl_gathers/index.js

43 lines
909 B
JavaScript
Raw Normal View History

2015-07-20 09:41:58 +00:00
"use strict";
2015-10-01 12:40:47 +00:00
var env = process.env.NODE_ENV || "development";
if (env === "production") {
require("newrelic");
}
2015-07-20 09:41:58 +00:00
var fs = require("fs");
var path = require("path");
var express = require("express");
var app = express();
2015-07-20 09:41:58 +00:00
var server = require('http').Server(app);
var io = require('socket.io')(server);
var config = require(path.join(__dirname, "config/config.js"));
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
2015-09-17 19:59:05 +00:00
if (env !== "test") {
require(path.join(__dirname, "lib/steam/bot"))(config.steamBot);
}
2015-09-14 17:11:52 +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);
2016-01-22 11:21:43 +00:00
require(path.join(__dirname, "config/socketio"))(io);
2015-07-20 09:41:58 +00:00
// Configure socket.io server
server.listen(config.port);
2015-07-20 09:41:58 +00:00
console.log("Listening on port", config.port);
module.exports = {
app: app,
server: server,
io: io
};