This commit is contained in:
Lukian LEIZOUR 2024-06-03 12:09:17 +02:00
parent 7c72d5c81d
commit 5fc03eb375
3 changed files with 17 additions and 2 deletions

View file

@ -4,6 +4,7 @@ const path = require("path");
const config = require("./config");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const https = require("https");
require("dotenv").config();
const app = express();
@ -32,3 +33,14 @@ loadRoutes("api");
app.listen(port, () => {
console.log(`Server listening on http://localhost:${port}/`);
});
const privateKey = fs.readFileSync("./sslcert/privkey.pem", "utf8");
const certificate = fs.readFileSync("./sslcert/fullchain.pem", "utf8");
const credentials = { key: privateKey, cert: certificate };
const httpsServer = https.createServer(credentials, app);
httpsServer.listen(443, () => {
console.log("https server listening on port 443")
})