diff options
Diffstat (limited to 'pnhandler.js')
-rw-r--r-- | pnhandler.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pnhandler.js b/pnhandler.js index dba03db..63637ab 100644 --- a/pnhandler.js +++ b/pnhandler.js @@ -39,6 +39,28 @@ function upload(query, reqdata, res) { res.end(); } +function info(query, reqdata, res) { + util.log('[pnhandler] handling ' + query.pathname); + + var body = + '<!DOCTYPE html>\n' + + '<html>\n' + + '<head>\n' + + '<title>Info</title>\n' + + '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n' + + '</head>\n' + + '<body>\n' + + '<h1 style="background-color: gray; color: lime">Node.JS Server Info</h1>' + + 'Node ' + process.version + ', uptime ' + process.uptime() + ' seconds' + '<br />' + + 'Memory usage: ' + process.memoryUsage().heapTotal / (1024*1204) + 'MB<br />' + + '</body>\n' + + '</html>\n'; + + res.writeHead(200, {'Content-Type': 'text/html'}); + res.write(body); + res.end(); +} + function hello(query, reqdata, res) { util.log('[pnhandler] handling ' + query.pathname); @@ -89,6 +111,7 @@ exports.register = register; exports.login = login; exports.poll = poll; exports.upload = upload; +exports.info = info, exports.hello = hello; exports.hellores = hellores; |