2016-04-08 21 views
2

https modülü localhost'umda çalışmıyor. Bu blog.mgechev.com öğreticiden geçtim. Düğüm v5.10.1. İştehttps ssl/tls, localhost'ta localhost'ta çalışmıyor

kodu:

//index.js 
var fs = require('fs'), 
https = require('https'), 
express = require('express'), 
app = express(); 

https.createServer({ 
    key: fs.readFileSync('key.pem'), 
    cert: fs.readFileSync('cert.pem') 
}, app).listen(55555); 

app.get('/', function (req, res) { 
    res.header('Content-type', 'text/html'); 
    return res.end('<h1>Hello, Secure World!</h1>'); 
}); 

düğüm Çıktı

index.js:

enter image description here

+0

https deneyin: // localhost: 55555 –

+0

ben bu deneyin ancak otomatik olarak 'yönlendirildi www.localhost.com: 55555' – vineet

+0

Düğüm sunucusu başlatıldıktan sonra terminalde şifre yazıyor musunuz? –

cevap

2

Aptalca bir hatadır. Önceden https ile URL'yi vurdum ve iyi çalışıyor. olduğu

: -

https: // localhost: 55555