node.js - Getting Node, Running on OS X, to Respond to HTTPS Connections -


i have small node program.

console.log("program started"); var http = require('http');  //configure our http server respond hello world requests. var server = http.createserver(function (request, response) {           console.log("processing request url" + request.url);     response.writehead(200, {"content-type": "text/html"});     response.end("hello world \n"); });  // listen on port 8000, ip defaults 127.0.0.1 server.listen(8000);  console.log("program ended");     

if run program on macbook , access following url, see hello world message.

http://localhost:8000/ 

however, i'd have url responding https connections well.

https://localhost:8000/ 

how can nodejs?

can native http library me? or need express?

yes can via https module :

1 have create certificats , can follow auto here macos

https://stackoverflow.com/a/42298344/8395557


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -