diff --git a/examples/README.md b/examples/README.md index 642ebf0..5392840 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,8 +2,8 @@ To run the examples: -1. Clone this repo -2. Run `npm install` -3. Run `grunt build` -4. Run `npm run examples` -5. Open http://localhost:3000 +1. `git clone git@github.com:mzabriskie/axios.git` +2. `npm install` +3. `grunt build` +4. `npm run examples` +5. [http://localhost:3000](http://localhost:3000) diff --git a/examples/server.js b/examples/server.js index c5937d8..525fb63 100644 --- a/examples/server.js +++ b/examples/server.js @@ -23,6 +23,31 @@ function listDirs(root) { return dirs; } +function getIndexTemplate() { + var links = dirs.map(function (dir) { + var url = '/' + dir; + return '
  • ' + url + '
  • '; + }); + + return ( + '' + + '' + + '' + + 'axios examples' + + '' + + '' + + '' + ); +} + function sendResponse(res, statusCode, body) { res.writeHead(statusCode); res.write(body); @@ -72,10 +97,7 @@ server = http.createServer(function (req, res) { // Process / if (url === '/' || url === '/index.html') { - var links = dirs.map(function (dir) { - return '
  • ' + dir + '
  • '; - }); - send200(res, ''); + send200(res, getIndexTemplate()); return; }