Skip to content

Instantly share code, notes, and snippets.

@oleksiiBobko
Created August 4, 2016 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleksiiBobko/9913709e65bc3525389a04a633d1b36d to your computer and use it in GitHub Desktop.
Save oleksiiBobko/9913709e65bc3525389a04a633d1b36d to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var fs = require("fs");
var http = require("https");
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var handler = function (req, res) {
console.log('-------------------------');
console.log(req.headers);
req.on('data', function(chunk) {
console.log("Received body data:");
console.log(chunk.toString());
});
res.writeHead(200, {"Content-Type": "text/html"});
res.write("morning sir");
res.end();
};
var server = http.createServer(options, handler);
server.listen(5000);
console.log("Server is listening");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment