Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgo committed Aug 22, 2014
1 parent 754379b commit aa7462e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var express = require('express')
var app = express();
var latency = require('./lib/latency')

//setup additional routes
latency(app)

var server = app.listen(3000, function() {
console.log('Listening on port %d', server.address().port)
});
11 changes: 11 additions & 0 deletions lib/latency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = function setup(app){
app.get('/', function(req, res){
res.send('Hello World')
})
app.get('/:delay', function(req, res){
setTimeout(function finish(){
res.json({delay: req.params.delay, status: 'ok'})
},
req.params.delay)
})
}
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "latency-test",
"version": "0.0.1",
"description": "A simple web server that responds to requests with a specified latency",
"main": "index.js",
"scripts": {
"test": "node test"
},
"repository": {
"type": "git",
"url": "https://github.com/Concurix/latency-test.git"
},
"keywords": [
"concurix",
"latency"
],
"author": "[email protected]",
"license": "MIT",
"bugs": {
"url": "https://github.com/Concurix/latency-test/issues"
},
"homepage": "https://github.com/Concurix/latency-test",
"dependencies": {
"concurix": "0.0.3",
"express": "^4.8.5"
},
"jshintConfig": {
"node": true,
"browser": true,
"devel": true,
"jquery": true,
"undef": true,
"unused": true,
"asi": true,
"indent": 2,
"eqnull": true,
"loopfunc": true,
"eqeqeq": false,
"newcap": false,
"globalstrict": true,
"validthis": true
}
}

0 comments on commit aa7462e

Please sign in to comment.