// This is a static Express 4 web server script which can
// respond to both HTTP and HTTPS clients.

const express     = require('express');
const app = express();

app.use(express.static('/ your directory of web docs '))

app.listen(8000); // this port is not secure


// Add the following code to handle HTTPS requests.
// Visit Let's Encrypt for more information about their certificates.

const https       = require('https');
const fs          = require('fs');

const certsDir = '/etc/letsencrypt/live/ your.domain /';

const SSLparams = {
   key  : fs.readFileSync(certsDir + 'privkey.pem'),
   cert : fs.readFileSync(certsDir + 'cert.pem'),
   ca   : fs.readFileSync(certsDir + 'chain.pem')
};

https.createServer(SSLparams, app).listen(8001);


// https://sean.brunnock.com  12/2022