Node.js https Create https server from key

Description

Node.js https Create https server from key



var https = require('https');
var fs = require('fs');
var options = {//from  w  ww . j  a va2 s . c  om
    key: fs.readFileSync('./key.pem'),
    cert: fs.readFileSync('./cert.pem')
};

https.createServer(options,function(req,res){
    res.end('Hello client');
}).listen(3000);

console.log('server is running on port 3000');



PreviousNext

Related