commit
This commit is contained in:
parent
7c72d5c81d
commit
5fc03eb375
3 changed files with 17 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
/node_modules
|
/node_modules
|
||||||
.env
|
.env
|
||||||
|
sslcert/privkey.pem
|
||||||
|
sslcert/fullchain.pem
|
|
@ -10,3 +10,4 @@ services:
|
||||||
- /home/lucien/joclud_api:/app
|
- /home/lucien/joclud_api:/app
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
|
- "443:443"
|
12
index.js
12
index.js
|
@ -4,6 +4,7 @@ const path = require("path");
|
||||||
const config = require("./config");
|
const config = require("./config");
|
||||||
const cookieParser = require("cookie-parser");
|
const cookieParser = require("cookie-parser");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
|
const https = require("https");
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
@ -32,3 +33,14 @@ loadRoutes("api");
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Server listening on http://localhost:${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