A simple express.js middleware that redirects incoming unencrypted HTTP requests to HTTPS.
npm install expressjs-force-https
const express = require("express");
const forceHTTPS = require("expressjs-force-https").forceHTTPS;
const app = express();
//Redirecting incoming unencrypted http requests
app.use(forceHTTPS);
app.listen(3000, () => {
console.log(`Server Running...`);
});
const forceAzureHTTPS = require("expressjs-force-https").forceAzureHTTPS;
app.use(forceAzureHTTPS);