B
B
BestJS2016-10-27 13:51:10
Node.js
BestJS, 2016-10-27 13:51:10

Why doesn't https work on nodejs?

var fs = require('fs');
var options = {

    key: fs.readFileSync(__dirname + "/1.pem"),
    cert: fs.readFileSync(__dirname + "/3.crt"),

};

var server = https.createServer({}, express)

server.listen(80, () => {
  console.log(arguments)
});

If I do the same on http, everything works: When I run it on https, it does not give errors on the server, but in the browser: https://yadi.sk/i/N9nlvLTNxggYz Tell me what's the problem?
var server = express.listen(80);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-10-27
@BestJS

You are listening on port 80, and for https you need 443

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question