force-secure-express

Express middleware to redirect insecure http requests to https.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
force-secure-express
101.0.14 years ago4 years agoMinified + gzip package size for force-secure-express in KB

Readme

Force Secure Express
Travis Build Codecov npm downloads

Description

Express middleware to redirect insecure http requests to https.

Install

npm install force-secure-express --save

Usage

const forceSecure = require("force-secure-express");
const express = require("express");
const app = express();

const port = Number(process.env.PORT) || 3000;

app.use(forceSecure([
    "example.com",
    "staging.example.com"
]));

app.use(express.static("./public"));

app.get("*", (req, res) => {
  res.sendFile("./public/index.html")
});

app.listen(port, () => {
  logger.info(`${port} we have liftoff \u{1F680}`)
});