diff options
Diffstat (limited to 'server.js')
-rwxr-xr-x | server.js | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -3,7 +3,17 @@ const http = require("http"); const express = require("express"); const socketio = require("socket.io") -const PORT = 8080; +const PORT = (() => { + if (process.argv.length == 3) { + return +process.argv[2]; + } else if (process.argv.length == 2) { + return 8080; + } else { + console.log("Usage: server.js [port]"); + process.exit(1); + } +})(); + const app = express(); const server = http.Server(app); |