|
@ -5,40 +5,41 @@ |
|
|
* appropriate pages. |
|
|
* appropriate pages. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
//http server
|
|
|
|
|
|
|
|
|
/** Stores the configuration for the server */ |
|
|
|
|
|
const config = require('./utils/configLoader').getConfig(); |
|
|
|
|
|
|
|
|
|
|
|
/** Port for the server to run on */ |
|
|
|
|
|
const port = config.PORT; |
|
|
|
|
|
|
|
|
|
|
|
/** http server */ |
|
|
const http = require('http'); |
|
|
const http = require('http'); |
|
|
|
|
|
|
|
|
//used to parse the request URL
|
|
|
|
|
|
|
|
|
/** used to parse the request URL */ |
|
|
const url = require('url'); |
|
|
const url = require('url'); |
|
|
|
|
|
|
|
|
//express app
|
|
|
|
|
|
|
|
|
/** express app */ |
|
|
const express = require("express"); |
|
|
const express = require("express"); |
|
|
|
|
|
|
|
|
//express app
|
|
|
|
|
|
|
|
|
/** express app */ |
|
|
const app = express(); |
|
|
const app = express(); |
|
|
|
|
|
|
|
|
//server side logging
|
|
|
|
|
|
|
|
|
/** server side logging */ |
|
|
const sql = require('./utils/sql'); |
|
|
const sql = require('./utils/sql'); |
|
|
|
|
|
|
|
|
//Used for gzip compression
|
|
|
|
|
|
|
|
|
/** Used for gzip compression */ |
|
|
const compression = require('compression'); |
|
|
const compression = require('compression'); |
|
|
|
|
|
|
|
|
//used for file io
|
|
|
|
|
|
const utils = require('./utils/utils.js'); |
|
|
|
|
|
|
|
|
|
|
|
//Updates the site map whenever the server is started
|
|
|
|
|
|
|
|
|
/**Updates the site map whenever the server is started */ |
|
|
const map = require('./utils/generateSiteMap.js'); |
|
|
const map = require('./utils/generateSiteMap.js'); |
|
|
map.main(); |
|
|
map.main(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//port for the server to run on
|
|
|
|
|
|
const port = 8000; |
|
|
|
|
|
|
|
|
|
|
|
//session data for login
|
|
|
|
|
|
|
|
|
/**session data for login */ |
|
|
const session = require('express-session'); |
|
|
const session = require('express-session'); |
|
|
|
|
|
|
|
|
//Initializes sessions for login
|
|
|
|
|
|
app.use(session({ secret: utils.getFileLine('../session_secret'), cookie: { maxAge: 6000000 }})); |
|
|
|
|
|
|
|
|
/**Initializes sessions for login */ |
|
|
|
|
|
app.use(session({ secret: config.SESSION_SECRET, cookie: { maxAge: 6000000 }})); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const projects = ["/steam/"]; |
|
|
const projects = ["/steam/"]; |
|
@ -99,6 +100,4 @@ app.use(function(request, result) |
|
|
app.use(compression()); |
|
|
app.use(compression()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http.createServer(app).listen(port); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http.createServer(app).listen(port); |