Run npm init to create package.json file for the application

npm init

Then install Express in the app directory app and save it in the dependancies list

npm install express --save

Generate a self-signed certificate

cd sslcert
openssl req -nodes -new -x509 -keyout server.key -out server.cert

Enable HTTPS in Express (index.js)

var fs = require('fs');
var http = require('http');
var https = require('https');
var privateKey  = fs.readFileSync('sslcert/server.key', 'utf8');
var certificate = fs.readFileSync('sslcert/server.cert', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var express = require('express');
var app = express();
// configure headers for CORS
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
app.get('/', function (req, res) {
  console.log('GET received');
});'/cmd/wec', function (req, res) {
  console.log('POST received');
  res.send('POST received');
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
httpServer.listen(3000, function () {
  console.log('Example app listening on port 3000!');
httpsServer.listen(3443, function () {
  console.log('Example app listening on port 3443!');

Run it

node index.js