Add static file serving

This commit is contained in:
Quentin ANIERE 2022-04-11 12:34:40 +02:00
parent 6b6d1bddec
commit 2e6b84af84

View File

@ -10,9 +10,10 @@ const https_options = {
requestCert: false, requestCert: false,
rejectUnauthorized: false rejectUnauthorized: false
} }
const server = https.createServer(https_options, app); const socketHTTPSServer = https.createServer(https_options, app);
const webHTTPSServer = https.createServer(https_options, app);
const io = socketio(server, { const io = socketio(socketHTTPSServer, {
cors: { cors: {
origin: "https://danby.aniere.fr", origin: "https://danby.aniere.fr",
}, },
@ -33,6 +34,18 @@ io.on("connection", (client) => {
io.sockets.emit("update-count", {value: usersConnected}); io.sockets.emit("update-count", {value: usersConnected});
}); });
server.listen(3000, () => {
console.log("Server started on port 3000"); app.use(express.static("src"));
app.listen(80, () => {
console.log("Web server started on port 80")
});
webHTTPSServer.listen(443, () => {
console.log("Web HTTPS server started on port 443");
});
socketHTTPSServer.listen(3000, () => {
console.log("Socket HTTPS server started on port 3000");
}); });