Permalink
Browse files

Create HTTP Server in order to be able to test status dashboard easil…

…y. This one returns different status code on each call.
  • Loading branch information...
1 parent 5793dbc commit 09eccaea2142da451df05b3ec1b55c3601cc8763 @chamerling chamerling committed Jan 13, 2014
Showing with 29 additions and 0 deletions.
  1. +22 −0 samples/http.js
  2. +7 −0 settings.js
View
@@ -0,0 +1,22 @@
+/**
+ * HTTP Server for local test. Change the return status code on each request.
+ * 'node samples/http' will start an HTTP server on port 3303. Override with PORT system env if needed.
+ *
+ * @author Christophe Hamerling - christophe.hamerling@gmail.com
+ */
+
+var express = require('express');
+var app = express.createServer();
+
+var port = process.env.PORT || 3303;
+
+var random = [200, 202, 404, 500];
+
+app.get('*', function(req, res) {
+ var rand = Math.floor((Math.random()*random.length));
+ res.send(random[rand]);
+});
+
+app.listen(port, function(err) {
+ console.log('Started on port ', port);
+})
View
@@ -107,6 +107,13 @@ exports.create = function() {
check: 'pidfile',
pidfile: '/tmp/terminal.pid',
status: 'maintenance'
+ }, {
+ name: 'Local HTTP sample',
+ label: 'Local HTTP Sample: healthCheck',
+ check: 'http',
+ host: 'localhost',
+ port: '3303',
+ path: '/'
}],
serviceInterval: 6000,
plugins : {

0 comments on commit 09eccae

Please sign in to comment.