Node.js express create https server

Description

Node.js express create https server


var fs=require('fs'),
  key=fs.readFileSync(__dirname+'/cert/server.key'),
  cert=fs.readFileSync(__dirname+'/cert/server.crt'),
  app=require('express').createServer({key:key, cert:cert});

app.get('/', function(req, res){
  res.send('express https configured');
});//  w  ww. j  a  va2  s  .co m

app.listen(443);



PreviousNext

Related