From 636415051987cf86bc5b86924978cf7ac79ee570 Mon Sep 17 00:00:00 2001 From: vincentastolfi Date: Fri, 24 May 2024 08:58:55 +0200 Subject: [PATCH] :green_heart: some adjustment --- index.js | 8 +++++--- public/scripts/index.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 73d09df..f5c8e30 100644 --- a/index.js +++ b/index.js @@ -3,12 +3,14 @@ const app = express(); const http = require("http").Server(app); const { createServer } = require("http"); const { Server } = require("socket.io"); -const port = 8081; + +const port = 8080; +const url = "https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship" const httpServer = createServer(); const io = new Server(httpServer, { cors: { - origin: "https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship", + origin: url, // or with an array of origins // origin: ["https://my-frontend.com", "https://my-other-frontend.com", "http://localhost:3000"], credentials: true @@ -18,7 +20,7 @@ const io = new Server(httpServer, { app.use(express.static("public")); http.listen(port, () => { - console.log(`Listening on http://localhost:${port}`); + console.log(`Listening on ${url}:${port}`); }); module.exports = { diff --git a/public/scripts/index.js b/public/scripts/index.js index ea0e6df..68716f2 100644 --- a/public/scripts/index.js +++ b/public/scripts/index.js @@ -1,6 +1,6 @@ import { drawGrid, drawEnnemyGrid, play, selectPiece } from "./game.js"; -export const socket = io("https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship:8081", { +export const socket = io("https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship", { withCredentials: true, }); export let roomId = "";