/* eslint-env node */ const http = require("http"), express = require("express"), cors = require("cors"), colyseus = require("colyseus"), monitor = require("@colyseus/monitor").monitor, socialRoutes = require("@colyseus/social/express").default, StarGazerRoom = require("./lib/rooms/StarGazerRoom.js"), Logger = require("./lib/utils/Logger.js"), Config = require("./lib/config/ServerConfig.js"); var app = express(), server = http.createServer(app), gameServer; Logger.enable(); app.use(cors()); app.use(express.json()); gameServer = new colyseus.Server({ server: server, express: app }); gameServer.define(Config.getGameRoomName(), StarGazerRoom); // Must be set after game server is created app.use(Config.getSocialRoute(), socialRoutes); app.use(Config.getMonitorRoute(), monitor(gameServer)); // Prrobably shoud be set after game server is created app.use(Config.getGameRoute(), express.static(Config.getGamePath())); gameServer.listen(Config.getPort()); Logger.log(`Listening on ws://localhost:${ Config.getPort() }`, "Server");