Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 09eccaea2142da451df05b3ec1b55c3601cc8763 1 parent 5793dbc
Christophe Hamerling chamerling authored
Showing with 29 additions and 0 deletions.
  1. +22 −0 samples/http.js
  2. +7 −0 settings.js
22 samples/http.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);
+})
7 settings.js
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 : {
Please sign in to comment.
Something went wrong with that request. Please try again.