From d2b151ab85fcc5b58e25e3ed643c908a405624e4 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Sun, 8 Jun 2014 20:19:50 +0100 Subject: [PATCH] minor refactor --- README.md | 2 +- bin/ws.js | 14 +++++++------- lib/stats.js | 6 ++++++ 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 lib/stats.js diff --git a/README.md b/README.md index 0562fee..cc4948d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![view on npm](http://img.shields.io/npm/v/local-web-server.svg)](https://www.npmjs.org/package/local-web-server) -![npm module downloads per month](http://img.shields.io/npm/dm/local-web-server.svg) +[![npm module downloads per month](http://img.shields.io/npm/dm/local-web-server.svg)](https://www.npmjs.org/package/local-web-server) [![Dependency Status](https://david-dm.org/75lb/local-web-server.svg)](https://david-dm.org/75lb/local-web-server) ![Analytics](https://ga-beacon.appspot.com/UA-27725889-12/local-web-server/README.md?pixel) diff --git a/bin/ws.js b/bin/ws.js index b22b964..803b806 100755 --- a/bin/ws.js +++ b/bin/ws.js @@ -27,6 +27,13 @@ function halt(message){ process.exit(1); } +/* customised logger :date token, purely to satisfy Logstalgia. */ +morgan.token("date", function(){ + var a = new Date(); + return (a.getDate() + "/" + a.getUTCMonth() + "/" + a.getFullYear() + ":" + a.toTimeString()) + .replace("GMT", "").replace(" (BST)", ""); +}); + /* Merge together options from - ~/.local-web-server.json - {cwd}/.local-web-server.json @@ -74,13 +81,6 @@ if (argv.config){ process.exit(0); }); - /* customised logger :date token, purely to satisfy Logstalgia. */ - morgan.token("date", function(){ - var a = new Date(); - return (a.getDate() + "/" + a.getUTCMonth() + "/" + a.getFullYear() + ":" + a.toTimeString()) - .replace("GMT", "").replace(" (BST)", ""); - }); - var app = connect(); /* log using --log-format (if supplied), else output statics */ diff --git a/lib/stats.js b/lib/stats.js new file mode 100644 index 0000000..45ce32f --- /dev/null +++ b/lib/stats.js @@ -0,0 +1,6 @@ +"use strict"; + +exports.requests = 0; +exports.transferred = 0; +exports.requests = 0; +exports.requests = 0;