Skip to content

Instantly share code, notes, and snippets.

@beatak
Created June 16, 2018 00:34
Show Gist options
  • Select an option

  • Save beatak/819e9e627f8ca4fcf21efdc6c5486d3f to your computer and use it in GitHub Desktop.

Select an option

Save beatak/819e9e627f8ca4fcf21efdc6c5486d3f to your computer and use it in GitHub Desktop.
console.log('starting the web server!');
const http = require('http');
const _env = parseInt(process.env.PORT, 10);
const PORT = _env ? _env : 80;
http.createServer(function (req, res) {
console.log(`Req: ${req.url}`);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('hello world');
}).listen(PORT, function () {
console.log('Start to listen!');
console.log( JSON.stringify( [].slice.apply(arguments, [0]) ) );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment