Skip to content

Commit

Permalink
Merge pull request #6 from spadin/pr-4
Browse files Browse the repository at this point in the history
Modifying PR to keep current CLI arg structure
  • Loading branch information
spadin committed Dec 29, 2014
2 parents b949bbb + 309536a commit 672fe2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -22,7 +22,8 @@ If you need a different port:

Open [http://localhost:9999](http://localhost:9999)

To specify ip and port
If you need a different hostname:

$ node server 192.168.0.11 8181
$ HOSTNAME=192.168.0.1 node server

Open [http://192.168.0.1:4567](http://192.168.0.1:4567)
8 changes: 4 additions & 4 deletions server.js
Expand Up @@ -3,8 +3,8 @@ var express = require("express"),
bodyParser = require('body-parser'),
errorHandler = require('errorhandler'),
methodOverride = require('method-override'),
ip = process.argv[2] || '127.0.0.1',
port = process.argv[3] || parseInt(process.env.PORT, 10) || 4567;
hostname = process.env.HOSTNAME || 'localhost',
port = parseInt(process.env.PORT, 10) || 4567;

app.get("/", function (req, res) {
res.redirect("/index.html");
Expand All @@ -21,5 +21,5 @@ app.use(errorHandler({
showStack: true
}));

console.log("Simple static server listening at http://"+ip+":" + port);
app.listen(port, ip);
console.log("Simple static server listening at http://" + hostname + ":" + port);
app.listen(port, hostname);

0 comments on commit 672fe2f

Please sign in to comment.