Simple express/connect middleware to provide an "apache-like" /status.html page.
npm install mod_status
var express = require('express'),
status = require('../lib/index.js');
var app = express();
app.use(status({
url: '/status',
version: true,
uptime: true,
check: function(req) {
if (req.something == false) {
return false; //Don't show status
}
return true; //Show status
}
}));
console.log('Go to: http://127.0.0.1:8000/status');
app.listen(8000);
url - The URL to respond to, defaults to /status.htmlversion - Show the Node.js version in the output. Default: falseuptime - Show the uptime of the process in the output: Default: falsetext - Provide custom response text, will override all the above. Default: nullcheck - A function to check the request to see if the status page should be shown. Default: returns true to always showOK - DefaultOK - NodeJS: v0.10.17 - From version: trueOK - Uptime: 2 days, 3 hours, 4 minutes - From uptime: trueOK - NodeJSL v0.10.17 - Uptime: 2 days, 3 hours, 4 minutes - From uptime: true & version: trueWORKS - From text: 'WORKS'