Answer the question
In order to leave comments, you need to log in
How to listen on port 443 via express?
I use cloudflare for https. I generated cert.pem and key.pem for the domain. I threw everything into a small program:
var fs = require('fs');
var https = require('https');
var privateKey = fs.readFileSync('./key.pem', 'utf8');
var certificate = fs.readFileSync('./cert.pem', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var express = require('express');
var app = express();
var httpsServer = https.createServer(credentials, app);
app.get('/', (req, res) => {
res.send({ message: 'Hello WWW!' });
});
httpsServer.listen(8443);
Error 521
Web server is down
Answer the question
In order to leave comments, you need to log in
Install Nginx, in addition to the simplest Certificate Settings, you will also cache statics.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question