Created
August 4, 2016 08:28
-
-
Save oleksiiBobko/9913709e65bc3525389a04a633d1b36d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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