The issue has finally been fixed, thank you so much @WindLother and @dragonhunter1 for your help!
(Full code below if needed:)
index.js
const express = require("express");
const app = express();
const http = require("http");
const sockets = require("socket.io");
const cors = require("cors");
app.use(cors({
origin: "https://tic-tac-toe-ultimate.snakebyte.repl.co",
methods: "GET",
preflightContinue: false,
optionsSuccessStatus: 204,
credentials: true
}));
app.use(express.static("public"));
const server = http.createServer(app);
const io = sockets(server, {
cors: {
origin: "https://tic-tac-toe-ultimate.snakebyte.repl.co",
methods: ["GET", "POST"],
},
});
app.get("/api/connection-check", (req, res) => {
res.json({
server_status: "good",
});
});
const port = process.env.PORT || 3000;
server.listen(port, function () {
console.log("Listening on port", port);
});