diff --git a/README.md b/README.md index cc529ac..3581f29 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ [![view on npm](http://img.shields.io/npm/v/local-web-server.svg)](https://www.npmjs.org/package/local-web-server) [![npm module downloads](http://img.shields.io/npm/dt/local-web-server.svg)](https://www.npmjs.org/package/local-web-server) -[![Build Status](https://travis-ci.org/75lb/local-web-server.svg?branch=master)](https://travis-ci.org/75lb/local-web-server) -[![Dependency Status](https://david-dm.org/75lb/local-web-server.svg)](https://david-dm.org/75lb/local-web-server) +[![Build Status](https://travis-ci.org/lwsjs/local-web-server.svg?branch=master)](https://travis-ci.org/lwsjs/local-web-server) +[![Dependency Status](https://david-dm.org/lwsjs/local-web-server.svg)](https://david-dm.org/lwsjs/local-web-server) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) -[![Join the chat at https://gitter.im/75lb/local-web-server](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/75lb/local-web-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Join the chat at https://gitter.im/lwsjs/local-web-server](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lwsjs/local-web-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -***Requires node v4.0.0 or higher. Install the [previous release](https://github.com/75lb/local-web-server/tree/prev) for older node support.*** +***Requires node v7.6 or higher. Install the [previous release](https://github.com/lwsjs/local-web-server/tree/prev) for older node support.*** # local-web-server At its core, local-web-server is an application shell for building a specialised command-line web server to support productive Web Platform engineers. When combined with built-in and custom features it's in intended to by a powerful tool in helping build and debug Web applications. It comes bundled with a middleware stack covering common requirements but any arbitrary stack can be specified from the command line or config. @@ -37,7 +37,7 @@ Being an npm module, it is trivial is bundle and distribute/deploy with your web * Rewrite routes to local or remote resources * Efficient, predictable, entity-tag-powered conditional request handling (no need to 'Disable Cache' in DevTools, slowing page-load down) - * Configurable log output, compatible with [Goaccess, Logstalgia and glTail](https://github.com/75lb/local-web-server/blob/master/doc/visualisation.md) + * Configurable log output, compatible with [Goaccess, Logstalgia and glTail](https://github.com/lwsjs/local-web-server/blob/master/doc/visualisation.md) * Proxy server * Map local routes to remote servers. Removes CORS pain when consuming remote services. * Back-end service mocking @@ -91,7 +91,7 @@ local-web-server is a command-line tool. To serve the current directory, run `ws -h, --help Print these usage instructions. --config Print the stored config. - Project home: https://github.com/75lb/local-web-server + Project home: https://github.com/lwsjs/local-web-server diff --git a/doc/blacklist.md b/doc/blacklist.md index 6793d50..23a4d52 100644 --- a/doc/blacklist.md +++ b/doc/blacklist.md @@ -6,4 +6,4 @@ $ ws --forbid '*.json' '*.yml' serving at http://localhost:8000 ``` -[Example](https://github.com/75lb/local-web-server/tree/master/example/forbid). +[Example](https://github.com/lwsjs/local-web-server/tree/master/example/forbid). diff --git a/doc/https.md b/doc/https.md index 8802915..5867f0a 100644 --- a/doc/https.md +++ b/doc/https.md @@ -56,4 +56,4 @@ Chrome and Firefox will still complain your certificate has not been verified by Now you have a valid, trusted certificate for development. ### Built-in certificate -As a quick win, you can run `ws` with the `https` flag. This will launch an HTTPS server using a [built-in certificate](https://github.com/75lb/local-web-server/tree/master/ssl) registered to the domain 127.0.0.1. +As a quick win, you can run `ws` with the `https` flag. This will launch an HTTPS server using a [built-in certificate](https://github.com/lwsjs/local-web-server/tree/master/ssl) registered to the domain 127.0.0.1. diff --git a/doc/logging.md b/doc/logging.md index 593c0ca..3883d7b 100644 --- a/doc/logging.md +++ b/doc/logging.md @@ -48,7 +48,7 @@ Then pipe the `logstalgia` output format directly into logstalgia for real-time $ ws -f logstalgia | logstalgia - ``` -![local-web-server with logstalgia](https://raw.githubusercontent.com/75lb/local-web-server/master/doc/img/logstagia.gif) +![local-web-server with logstalgia](https://raw.githubusercontent.com/lwsjs/local-web-server/master/doc/img/logstagia.gif) ## glTail To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format: diff --git a/doc/mime-types.md b/doc/mime-types.md index 3251230..03d78fe 100644 --- a/doc/mime-types.md +++ b/doc/mime-types.md @@ -9,4 +9,4 @@ You can set additional mime-type/extension mappings, or override the defaults by } ``` -[Example](https://github.com/75lb/local-web-server/tree/master/example/mime-override). +[Example](https://github.com/lwsjs/local-web-server/tree/master/example/mime-override). diff --git a/doc/mock-response.md b/doc/mock-response.md index 2d2b796..a6fdc4d 100644 --- a/doc/mock-response.md +++ b/doc/mock-response.md @@ -238,4 +238,4 @@ const mockResponses = [ module.exports = mockResponses ``` -[Example](https://github.com/75lb/local-web-server/tree/master/example/mock). \ No newline at end of file +[Example](https://github.com/lwsjs/local-web-server/tree/master/example/mock). \ No newline at end of file diff --git a/doc/rewrite.md b/doc/rewrite.md index af1907a..1120a92 100644 --- a/doc/rewrite.md +++ b/doc/rewrite.md @@ -34,4 +34,4 @@ Map local requests for repo data to the Github API: $ ws --rewrite '/:user/repos/:name -> https://api.github.com/repos/:user/:name' ``` -[Example](https://github.com/75lb/local-web-server/tree/master/example/rewrite). +[Example](https://github.com/lwsjs/local-web-server/tree/master/example/rewrite). diff --git a/doc/spa.md b/doc/spa.md index 1c277e6..1a05b6e 100644 --- a/doc/spa.md +++ b/doc/spa.md @@ -9,4 +9,4 @@ By default, typical SPA paths (e.g. `/user/1`, `/login`) would return `404 Not F *If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the specified SPA and handle the route client-side.* -[Example](https://github.com/75lb/local-web-server/tree/master/example/spa). +[Example](https://github.com/lwsjs/local-web-server/tree/master/example/spa). diff --git a/doc/visualisation.md b/doc/visualisation.md index c31ce9d..2ca61d9 100644 --- a/doc/visualisation.md +++ b/doc/visualisation.md @@ -35,7 +35,7 @@ Then pipe the `logstalgia` output format directly into logstalgia for real-time $ ws -f logstalgia | logstalgia - ``` -![local-web-server with logstalgia](https://raw.githubusercontent.com/75lb/local-web-server/master/doc/img/logstagia.gif) +![local-web-server with logstalgia](https://raw.githubusercontent.com/lwsjs/local-web-server/master/doc/img/logstagia.gif) ## glTail To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format: diff --git a/example/README.md b/example/README.md deleted file mode 100644 index 0e12d08..0000000 --- a/example/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Examples - -Some examples of how to use the built-in middleware and configure custom servers. diff --git a/example/features/vanilla.js b/example/features/vanilla.js deleted file mode 100644 index 1617454..0000000 --- a/example/features/vanilla.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict' - -class Yeah { - middleware () { - return function (req, res, next) { - res.end('Yeah?') - next() - } - } -} - -class Logger { - middleware () { - const express = require('express') - const app = express() - app.use((req, res, next) => { - console.log('incoming', req.url) - next() - }) - return app - } -} - -class Header { - middleware () { - return function (req, res, next) { - res.setHeader('x-pointless', 'yeah?') - next() - } - } -} - -class PieHeader { - middleware () { - const Koa = require('koa') - const app = new Koa() - app.use((ctx, next) => { - ctx.set('x-pie', 'steak and kidney') - next() - }) - return app.callback() - } -} - -const http = require('http') -const server = http.createServer() -server.listen(8100) -const yeah = new Yeah() -const logger = new Logger() -const header = new Header() -const pie = new PieHeader() -const stack = [ - logger.middleware(), - header.middleware(), - pie.middleware(), - yeah.middleware() -] -server.on('request', function (req, res) { - let index = 0 - function processNext () { - const mw = stack[index++] - if (mw) mw(req, res, processNext) - } - processNext() -}) diff --git a/lib/local-web-server.js b/lib/local-web-server.js index 8eba429..fc889a2 100644 --- a/lib/local-web-server.js +++ b/lib/local-web-server.js @@ -37,6 +37,19 @@ class LocalWebServer extends Lws { const pkg = require(path.resolve(__dirname, '..', 'package.json')) return pkg.version } + + getUsageHeader () { + return { + header: 'local-web-server', + content: 'A convenient local web server to support productive, full-stack Javascript development.' + } + } + + getUsageFooter () { + return { + content: 'Project home: [underline]{https://github.com/lwsjs/local-web-server}' + } + } } module.exports = LocalWebServer diff --git a/package.json b/package.json index 80b0e25..42ed72e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "local-web-server", "version": "2.0.0-pre.0", - "description": "A simple web-server for productive front-end development", + "description": "A convenient local web server to support productive, full-stack Javascript development", "bin": { "ws": "./bin/cli.js" }, @@ -49,8 +49,8 @@ "lws-mock-response": "^0.1.0", "lws-rewrite": "^0.1.0", "lws-spa": "^0.1.0", - "lws-static": "^0.1.0", - "lws": "^1.0.0-pre.2" + "lws-static": "^0.1.1", + "lws": "^1.0.0-pre.3" }, "devDependencies": { "test-runner": "^0.3.0"