Add static file serving
This commit is contained in:
parent
6b6d1bddec
commit
2e6b84af84
21
index.js
21
index.js
@ -10,9 +10,10 @@ const https_options = {
|
||||
requestCert: 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: {
|
||||
origin: "https://danby.aniere.fr",
|
||||
},
|
||||
@ -33,6 +34,18 @@ io.on("connection", (client) => {
|
||||
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");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user