Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
show server status
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Jan 6, 2011
1 parent 2b67b5d commit 6b8cc1a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RESTRICTED_IPS = /^(10\.)|(127\.)|(169\.254)|(192\.168)|(172\.(1[6-9])|(2[0-9])|

total_connections = 0
current_connections = 0
started_at = new Date

four_oh_four = (resp, msg) ->
log msg
Expand All @@ -39,6 +40,9 @@ server = Http.createServer (req, resp) ->
else if req.url == '/favicon.ico'
resp.writeHead 200
resp.end 'ok'
else if req.url == '/status'
resp.writeHead 200
resp.end "ok #{current_connections}/#{total_connections} since #{started_at.toString()}"
else
total_connections += 1
current_connections += 1
Expand Down

0 comments on commit 6b8cc1a

Please sign in to comment.