Skip to content
Snippets Groups Projects
Commit aa534627 authored by AceZephyr's avatar AceZephyr
Browse files

Customizable hostname/port

parent f4957f9d
No related branches found
No related tags found
No related merge requests found
/env.json
/settings.json
/node_modules/
/login.sqlite
\ No newline at end of file
......@@ -3,6 +3,7 @@ const {createServer} = require("http");
const {Server} = require("socket.io");
const sgen = require('sudoku-gen');
const login = require("./login.js")
const fs = require("fs");
const app = express();
app.use(express.json());
......@@ -13,8 +14,13 @@ const io = new Server(httpServer);
app.use(express.static("public"));
const port = 3000;
const hostname = "localhost";
const {
hostname,
port
} = fs.existsSync("../settings.json") ? JSON.parse(fs.readFileSync("../settings.json").toString()) : {
hostname: "localhost",
port: 3000
};
const GAMES = new Map(); // maps game id -> game
......@@ -392,5 +398,5 @@ io.on("connection", (socket) => {
});
httpServer.listen(port, hostname,() => {
console.log(`http://${hostname}:${port}`);
console.log(`Listening on hostname ${hostname} port ${port}`);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment