commit
This commit is contained in:
parent
7c72d5c81d
commit
5fc03eb375
3 changed files with 17 additions and 2 deletions
12
index.js
12
index.js
|
@ -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")
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue