Skip to content

Instantly share code, notes, and snippets.

@TiagoGouvea
Created April 26, 2020 22:02
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 TiagoGouvea/d0b2679f6b921864ff899f0106469552 to your computer and use it in GitHub Desktop.
Save TiagoGouvea/d0b2679f6b921864ff899f0106469552 to your computer and use it in GitHub Desktop.
Simplest node script
var http = require('http');
var handleRequest = function(request, response) {
response.writeHead(200);
response.end("I'm alive");
}
var www = http.createServer(handleRequest);
var port = process.env.PORT || 8080;
www.listen(port, function () {
console.log("Node server listening at port "+port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment