Skip to content

Commit

Permalink
Merge pull request #141 from smileart/master
Browse files Browse the repository at this point in the history
Added useful tip with local addresses
  • Loading branch information
indexzero committed Jun 8, 2015
2 parents ac38a04 + 83840b5 commit def01f3
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions bin/http-server
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env node

var colors = require('colors'),
os = require('os'),
httpServer = require('../lib/http-server'),
portfinder = require('portfinder'),
opener = require('opener'),
argv = require('optimist')
opener = require('opener'),
argv = require('optimist')
.boolean('cors')
.argv;

var ifaces = os.networkInterfaces();

if (argv.h || argv.help) {
console.log([
"usage: http-server [path] [options]",
Expand Down Expand Up @@ -98,6 +101,16 @@ function listen(port) {
+ ' on: '.yellow
+ (protocol + '//' + host + ':' + port).cyan);

log('\nAvailable on:'.yellow);

Object.keys(ifaces).forEach(function (dev) {
ifaces[dev].forEach(function (details) {
if (details.family == 'IPv4') {
log((" http://" + details.address + ":" + port.toString()).green);
}
});
});

if (typeof proxy === 'string') {
log('Unhandled requests will be served from: ' + proxy);
}
Expand Down

0 comments on commit def01f3

Please sign in to comment.