|
|
@ -3,12 +3,14 @@ const app = express();
|
|
|
|
const http = require("http").Server(app);
|
|
|
|
const http = require("http").Server(app);
|
|
|
|
const { createServer } = require("http");
|
|
|
|
const { createServer } = require("http");
|
|
|
|
const { Server } = require("socket.io");
|
|
|
|
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 httpServer = createServer();
|
|
|
|
const io = new Server(httpServer, {
|
|
|
|
const io = new Server(httpServer, {
|
|
|
|
cors: {
|
|
|
|
cors: {
|
|
|
|
origin: "https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship",
|
|
|
|
origin: url,
|
|
|
|
// or with an array of origins
|
|
|
|
// or with an array of origins
|
|
|
|
// origin: ["https://my-frontend.com", "https://my-other-frontend.com", "http://localhost:3000"],
|
|
|
|
// origin: ["https://my-frontend.com", "https://my-other-frontend.com", "http://localhost:3000"],
|
|
|
|
credentials: true
|
|
|
|
credentials: true
|
|
|
@ -18,7 +20,7 @@ const io = new Server(httpServer, {
|
|
|
|
app.use(express.static("public"));
|
|
|
|
app.use(express.static("public"));
|
|
|
|
|
|
|
|
|
|
|
|
http.listen(port, () => {
|
|
|
|
http.listen(port, () => {
|
|
|
|
console.log(`Listening on http://localhost:${port}`);
|
|
|
|
console.log(`Listening on ${url}:${port}`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
module.exports = {
|
|
|
|