web-app-runner
Advanced tools
Comparing version 0.90.34 to 0.90.35
@@ -9,2 +9,3 @@ /** | ||
dash = require('lodash' ), | ||
os = require( 'os' ), | ||
IPFilter = require('./IPFilter' ), | ||
@@ -24,2 +25,3 @@ Visitor = require('./Visitor' ), | ||
env = options.env || 'development', | ||
epoch = new Date(), | ||
startPage = options.startPage, | ||
@@ -46,2 +48,3 @@ ipfilter = options.ipfilter, | ||
app.use( server.landingPageRouter ); | ||
app.use( server.statusPage ); | ||
@@ -95,2 +98,32 @@ app.use( serveStatic( home ) ); | ||
this.statusPage = function(request, response, next) { | ||
var url = request.url, | ||
obj, | ||
json; | ||
if (url === '/status') { | ||
obj = {}; | ||
obj.env = env; | ||
obj.epoch = epoch.toISOString(); | ||
// obj.uptime = Date.now() - epoch.getTime(); | ||
obj.pid = process.pid; | ||
obj.totalmem = os.totalmem(); | ||
obj.freemem = os.freemem(); | ||
obj.arch = os.arch(); | ||
json = JSON.stringify( obj ); | ||
response.writeHead(200, { | ||
'Content-Length': json.length, | ||
'Content-Type': 'application/json' | ||
}); | ||
log.info( json ); | ||
response.end( json ); | ||
} else { | ||
next(); | ||
} | ||
}; | ||
/** | ||
@@ -97,0 +130,0 @@ * shutdown middleware. |
{ | ||
"name": "web-app-runner", | ||
"version": "0.90.34", | ||
"version": "0.90.35", | ||
"description": "A simple HTTP application server that accepts or rejects connections based on authenticated attributes including ip, user agent, etc. The server can be used stand alone or as middleware for connect or express.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -208,5 +208,5 @@ # Web App Runner | ||
There is also a more realistic production runner in the bin folder called bin/start.js that includes conf.js and stop.js scripts. | ||
There is also a more realistic production runner in the bin folder called bin/ that includes conf.js, start.js, status.js and stop.js scripts. | ||
- - - | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.34</em></small></p> | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.35</em></small></p> |
@@ -123,2 +123,3 @@ /** | ||
'landingPageRouter', | ||
'statusPage', | ||
'shutdown', | ||
@@ -125,0 +126,0 @@ 'stop', |
@@ -13,3 +13,2 @@ # Web App Runner To Do List | ||
* add Logger to enable creating category logger | ||
* modify to use socket logger for multiple servers | ||
* implement agent filter | ||
@@ -16,0 +15,0 @@ |
60254
28
1000
6
2