Last active
September 19, 2017 17:40
-
-
Save hepplerj/5a72d90e1c54698a700110f8aaeb504a to your computer and use it in GitHub Desktop.
Checking server connections
This file contains hidden or 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
var http = require('http'); | |
function handler(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello world\n'); | |
} | |
http.createServer(handler).listen(3000, '127.0.0.1'); | |
http.createServer(handler).listen(3001, 'localhost'); | |
http.createServer(handler).listen(3002, '127.0.0.1'); // ifconfig | |
http.createServer(handler).listen(3003, 'host.example.com'); // echo $HOSTNAME | |
http.createServer(handler).listen(3004, 'LocalHostName.local'); // scutil --get LocalHostName | |
// $ node multiserver.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment