Skip to content
Snippets Groups Projects
Commit 74a79530 authored by atm2g19's avatar atm2g19
Browse files

updated security

parent ab178829
No related branches found
No related tags found
No related merge requests found
dbconf.json
dst/
node_modules/
launch.json
......@@ -12,3 +11,4 @@ public/**/tsconfig.json
nodemon.json
public/js/p5/.DS_Store
public/js/p5/README.txt
.security/
\ No newline at end of file
This diff is collapsed.
......@@ -4,8 +4,8 @@
"description": "node-based backend and frontend for web-games",
"main": "server.js",
"scripts": {
"run": "export PORT=80; node server.js",
"test": "export PORT=8080; export DEBUG=1; node server.js"
"run": "export PORT=443; node server.js",
"test": "export PORT=8443; export DEBUG=1; node server.js"
},
"author": "Alex Mansfield",
"license": "ISC",
......@@ -17,6 +17,7 @@
"@types/socket.io": "^2.1.4",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"express-force-ssl": "^0.3.2",
"multer": "^1.4.2",
"mysql": "^2.18.1",
"path": "^0.12.7",
......
......@@ -60,7 +60,7 @@ const DB = {
}
}
const MYSQL_CONFIG: mysql.ConnectionConfig = JSON.parse(readFileSync("./dbconf.json").toString());
const MYSQL_CONFIG: mysql.ConnectionConfig = JSON.parse(readFileSync(".security/dbconf.json").toString());
const Games: GameDB = new GameDB(MYSQL_CONFIG);
// POOL.getConnection((err) => {
......
import * as express from "express";
import {AutoRedirect as autoredir} from "./autoredirect"
import {Log} from "./log"
import {
AutoRedirect as autoredir
} from "./autoredirect"
import {
Log
} from "./log"
import * as error from "./error"
import {staticServe as serve} from "./sendFile"
import {game_api} from "./games"
import {
staticServe as serve
} from "./sendFile"
import {
game_api
} from "./games"
import * as bodyParser from "body-parser";
import multer = require("multer");
import {
forceSSL
//@ts-ignore
} from "express-force-ssl"
import {
readFileSync
} from "fs";
import {
createServer
} from "https";
const upload = multer();
const app : express.Application = express();
const PORT : number = parseInt(process.env.PORT) || 8080;
const app: express.Application = express();
const PORT: number = parseInt(process.env.PORT) || 8080;
const SSL_OPTS = {
key: readFileSync(".security/origin.priv"),
cert: readFileSync(".security/origin.pem"),
}
let secServ = createServer(SSL_OPTS, app);
secServ.listen(PORT, () => {
console.log(`listening on port:${PORT}`);
});
// let server = app.listen(PORT, () => {
// console.log(`Listening on port ${PORT}`)
// });
const GAMES = game_api(secServ);
let server = app.listen(PORT, () => {console.log(`Listening on port ${PORT}`)});
const GAMES = game_api(server);
app.use(bodyParser.json());
// app.post('*', upload.array())
......@@ -30,6 +61,4 @@ app.get("*", serve("public/"));
app.use(error.error);
app.use(error.handled_error);
app.use(error.unhandled_error);
app.use(error.unhandled_error);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment