From fe47e1d8fe8345b5a94ee7bd05e60f25b10d99c4 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sat, 5 May 2018 09:34:21 -0400 Subject: [PATCH] Required fs for server.js --- server.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 7dfb8ef..a10d6b4 100644 --- a/server.js +++ b/server.js @@ -11,6 +11,8 @@ const url = require('url'); var express = require("express"); +const fs = require('fs'); + var session = require('express-session'); const includes = require('./includes/includes.js'); @@ -25,8 +27,11 @@ var app = express(); app.use(session({ secret: utils.getFileLine('../session_secret'), cookie: { maxAge: 6000000 }})); var privateKey = fs.readFileSync('/etc/letsencrypt/live/jrtechs.net/privkey.pem'); + var certificate = fs.readFileSync('/etc/letsencrypt/live/jrtechs.net/certificate.pem'); +var port = 8080; + /** * Parses the request url and calls correct JS files @@ -79,4 +84,8 @@ app.use(function(request, res) }) } }); -http.createServer(app).listen(8080); + +https.createServer({ + key: privateKey, + cert: certificate +}, app).listen(port);