This a simple, easy-to-follow tutorial on how to serve pages over in using Framework. https NodeJS Express Tools/Frameworks we would be using for this tutorial, are: NodeJS: You should’ve basic knowledge on how to program in . NodeJS OpenSSL: A tool to generate key and certificate. ExpressJS ( ): Back-end framework for writing web servers in NodeJS. More about . npm i express Express : Comes with NodeJS. https Let’s set-up our project directory. It’s not a directory with lots of files. Instead, it contains only 4 files which are , , and . So, create a new directory , and run to create file. package.json key.pem cert.pem server.js node-https cd node-https npm init -y package.json Now install using . Create a file and type the following code in it. express npm i --save express server.js Our should look like this: server.js const app = require('express')();const https = require('https');const fs = require('fs');//GET home routeapp.get('/', (req, res) => { res.send('Hello World');});// we will pass our 'app' to 'https' serverhttps.createServer(app).listen(3000); That’s it. Now if you run and visit you won’t see anything but an error! It’s time to fix that error. node server.js localhost:3000 Generate cert.pem and key.pem Using OpenSSL( ), we will generate our and . So, here’s how you could do this: ? key cert openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 : This flag let know where to save file. I can be an absolute file location. -keyout openssl key.pem : This flag let know where to save file. I can be an absolute file location as well. -out openssl cert.pem : This flag specifies the number of days the SSL will be valid. -days Make sure to run above command inside the directory where is present. Answer all questions. If all went well, you should see two new files in your project root, i.e. and . server.js cert.pem key.pem Open and include cert and key file in your function. Just like the below example. server.js https.createServer() const app = require('express')();const https = require('https');const fs = require('fs');//GET home routeapp.get('/', (req, res) => { res.send('Hello World');});// we will pass our 'app' to 'https' serverhttps.createServer({ key: fs.readFileSync('./key.pem'), cert: fs.readFileSync('./cert.pem'), passphrase: 'YOUR PASSPHRASE HERE'}, app).listen(3000); Open a terminal window and run . It should run without any error. Open your favourite browser and visit and you should see . node server.js https://localhost:3000 Hello World You may see some SSL warning. That’s because your certificate ain’t issued by any verified organization. What you want to do is, add the cert as an exception to your browser. Good Day!!