Skip to content

Instantly share code, notes, and snippets.

@jdstaerk
Created December 16, 2018 19:45
Show Gist options
  • Select an option

  • Save jdstaerk/7a4c43ea94cefd682c12f20d95e9b0a8 to your computer and use it in GitHub Desktop.

Select an option

Save jdstaerk/7a4c43ea94cefd682c12f20d95e9b0a8 to your computer and use it in GitHub Desktop.
const os = require('os');
const http = require('http');
const requestHandler = (req, res) => {
console.log('Request incoming from ' + req.connection.remoteAddress);
res.writeHead(200);
res.end('Success! You\'ve hit ' + os.hostname() + ' on ' + os.platform() + '!');
};
const server = http.createServer(requestHandler)
server.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment