Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ $ curl http://localhost:5000/foo/bar
}
```

## Command line arguments

```
--verbose log request data to the console
```

## Simulate delays

Include `/delay/<time in ms>` in the url
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"repo": "https://github.com/jpillora/grunt-source-node.git"
},
"dependencies": {
"mongoose": "^3.8.16"
"mongoose": "^3.8.16",
"minimist": "^1.1.0"
}
}
4 changes: 3 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ var pkg = require("./package.json");
var metrics = require("./metrics");
var http = require("http");
var dns = require("dns");
var port = process.env.PORT || parseInt(process.argv[2], 10) || 4000;
var argv = require('minimist')(process.argv.slice(2));
var port = process.env.PORT || argv._[0] || 4000;
var echoes = [];
var total = 0;
var live = 0;
Expand Down Expand Up @@ -126,6 +127,7 @@ http.createServer(function(req, res) {
if (echoes.length >= 100) echoes.unshift();
//push onto the back
echoes.push(data);
if (argv.verbose) console.log(data);
req.on('data', function(buffer) {
data.body += buffer.toString();
});
Expand Down