fs.js:427
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'ssh_key.pem'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object. (/Users/lichao/Desktop/nodeStudy/https.js:5:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
源码为:
var https=require('https');
var fs=require('fs');
var options={
key:fs.readFileSync('ssh_key.pem'),
cert:fs.readFileSync('ssh_cert.pem')
}
https
.createServer(options,function(req,res){
res.writeHead(200);
res.end('Hello zhdail')
}).listen('8080') |