server.js
/**
 * @author: Klement Omeri
 * Special thanks to Klement for providing the function to redirect traffic from http to https
 */
@author: Klement Omeri
Special thanks to Klement for providing the function to redirect traffic from http to https
@author : Klement Omeri Special thanks to Klement for providing the function to redirect traffic from http to https
function requireHTTPS(req, res, next) {
  if (!req.secure && req.get('x-forwarded-proto') !== 'https') {
    return res.redirect('https://' + req.get('host') + req.url);
  }
  next();
}
function requireHTTPS ( req , res , next ) { if ( ! req . secure && req . get ( 'x-forwarded-proto' ) !== 'https' ) { return res . redirect ( 'https://' + req . get ( 'host' ) + req . url ) ; } next ( ) ; }
@author: Klement Omeri
 Special thanks to Klement for providing the function to redirect traffic from http to https
@author : Klement Omeri Special thanks to Klement for providing the function to redirect traffic from http to https
// The 'x-forwarded-proto' check is for Heroku