mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
create https or http server according to environment
This commit is contained in:
parent
b1e9489ba9
commit
f5a2be82ca
1 changed files with 8 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// Import API
|
||||
const express = require("express");
|
||||
const http = require("http");
|
||||
const https = require("https");
|
||||
const dotenv = require('dotenv')
|
||||
|
||||
// Import Sockets
|
||||
|
|
@ -61,8 +62,13 @@ const configureServer = (httpServer) => {
|
|||
});
|
||||
};
|
||||
|
||||
// Start sockets
|
||||
const server = http.createServer(app);
|
||||
// Start sockets (depending on the dev or prod environment)
|
||||
let server;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
server = https.createServer(app);
|
||||
} else {
|
||||
server = http.createServer(app);
|
||||
}
|
||||
const io = configureServer(server);
|
||||
|
||||
setupWebsocket(io);
|
||||
|
|
|
|||
Loading…
Reference in a new issue