nodeJs搭建HTTPS服务器

var https = require('https');

var fs = require('fs');

var options = {

       key: fs.readFileSync('ssh_key.pem'),   //加载https证书

      cert: fs.readFileSync('ssh_cert.pem')

};

 

https.createServer(options, function(req, res){

     res.writeHead(200);

     res.end('hello https');

}).listen(8080);

 

相关文章:

  • 2021-11-24
  • 2021-06-05
  • 2022-01-21
  • 2022-01-08
  • 2021-10-01
  • 2021-11-12
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-01-11
相关资源
相似解决方案