Generate trusted local SSL/TLS certificates for local SSL development
npm install devcert-sanscache
npm install devcert-sanscache
`
$3
So, running a local HTTPS server usually sucks. There's a range of approaches,
each with their own tradeoff. The common one, using self-signed certificates,
means having to ignore scary browser warnings for each project.
devcert makes the process easy. Want a private key and certificate file to use
with your server? Just ask:
`js
import * as https from 'https';
import * as express from 'express';
import getDevelopmentCertificate from 'devcert';
let app = express();
app.get('/', function (req, res) {
res.send('Hello Secure World!');
});
getDevelopmentCertificate('myapp').then((ssl) => {
https.createServer(ssl, app).listen(3000);
});
`
Now open https://myapp:3000 (assuming host configuration, or otherwise https://localhost:3000) and voila
- your page loads with no scary warnings or hoops to jump through.
$3
Thankully, Firefox makes this easy. There's a point-and-click wizard for
importing and trusting a certificate - devcert will instead automatically
open Firefox and kick off this wizard for you. Simply follow the prompts to
trust the certificate.
The software installed varies by OS:
* Mac: brew install nss
* Linux: apt install libnss3-tools`