0
const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
https.createServer(options,(req,res)=>{
console.log('https server start');
}).listen(8080,'localhost');
みなさん、 私はhttpsサーバーを作成しようとしました...そしてこのコード。 しかし、動作しません。私は同じフォルダ内にこのコードnode.js localhost httpsサーバーが何も動作していない
openssl genrsa 1024 > key.pem
openssl req -x509 -new -key key.pem > cert.pem
と、このことのようにローカルホストサーバ
ためkey.pem、cert.pemをを行う前
ではなく、このenter image description here
のような作業しますありがとう、よろしく!
親愛なるrobertklepを。最初にあなたのためにありがとう~~~~私にはwsome anwer私は私のアプリケーションを修正します。本当に本当に本当にありがとうございました! –