Redirecting HTTP to HTTPS. It forces SSL (HTTPS) when HTTP is required using Express (Nodejs) and remove www and trailing slash on your domain.
npm install ssl-express-www
var express = require('express');
var secure = require('ssl-express-www');
var app = express();
app.use(secure);
var port = process.env.PORT || 3000;
app.listen(port, () => console.log('Server listening.'));
Transpile it with Babel
import express from 'express';
import secure from 'ssl-express-www';
const app = express();
app.use(secure);
let port = process.env.PORT || 3000;
app.listen(port, () => console.log('Server listening.'));
This project is licensed under the MIT License - see the LICENSE file for details