update repo URLs
This commit is contained in:
12
README.md
12
README.md
@ -1,11 +1,11 @@
|
|||||||
[](https://www.npmjs.org/package/local-web-server)
|
[](https://www.npmjs.org/package/local-web-server)
|
||||||
[](https://www.npmjs.org/package/local-web-server)
|
[](https://www.npmjs.org/package/local-web-server)
|
||||||
[](https://travis-ci.org/75lb/local-web-server)
|
[](https://travis-ci.org/lwsjs/local-web-server)
|
||||||
[](https://david-dm.org/75lb/local-web-server)
|
[](https://david-dm.org/lwsjs/local-web-server)
|
||||||
[](https://github.com/feross/standard)
|
[](https://github.com/feross/standard)
|
||||||
[](https://gitter.im/75lb/local-web-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](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
|
# 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.
|
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
|
* 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)
|
* 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
|
* Proxy server
|
||||||
* Map local routes to remote servers. Removes CORS pain when consuming remote services.
|
* Map local routes to remote servers. Removes CORS pain when consuming remote services.
|
||||||
* Back-end service mocking
|
* 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.
|
-h, --help Print these usage instructions.
|
||||||
--config Print the stored config.
|
--config Print the stored config.
|
||||||
|
|
||||||
Project home: https://github.com/75lb/local-web-server
|
Project home: https://github.com/lwsjs/local-web-server
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,4 +6,4 @@ $ ws --forbid '*.json' '*.yml'
|
|||||||
serving at http://localhost:8000
|
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).
|
||||||
|
@ -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.
|
Now you have a valid, trusted certificate for development.
|
||||||
|
|
||||||
### Built-in certificate
|
### 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.
|
||||||
|
@ -48,7 +48,7 @@ Then pipe the `logstalgia` output format directly into logstalgia for real-time
|
|||||||
$ ws -f logstalgia | logstalgia -
|
$ ws -f logstalgia | logstalgia -
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## glTail
|
## glTail
|
||||||
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
||||||
|
@ -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).
|
||||||
|
@ -238,4 +238,4 @@ const mockResponses = [
|
|||||||
module.exports = mockResponses
|
module.exports = mockResponses
|
||||||
```
|
```
|
||||||
|
|
||||||
[Example](https://github.com/75lb/local-web-server/tree/master/example/mock).
|
[Example](https://github.com/lwsjs/local-web-server/tree/master/example/mock).
|
@ -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'
|
$ 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).
|
||||||
|
@ -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.*
|
*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).
|
||||||
|
@ -35,7 +35,7 @@ Then pipe the `logstalgia` output format directly into logstalgia for real-time
|
|||||||
$ ws -f logstalgia | logstalgia -
|
$ ws -f logstalgia | logstalgia -
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## glTail
|
## glTail
|
||||||
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
# Examples
|
|
||||||
|
|
||||||
Some examples of how to use the built-in middleware and configure custom servers.
|
|
@ -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()
|
|
||||||
})
|
|
@ -37,6 +37,19 @@ class LocalWebServer extends Lws {
|
|||||||
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
|
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
|
||||||
return pkg.version
|
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
|
module.exports = LocalWebServer
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "local-web-server",
|
"name": "local-web-server",
|
||||||
"version": "2.0.0-pre.0",
|
"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": {
|
"bin": {
|
||||||
"ws": "./bin/cli.js"
|
"ws": "./bin/cli.js"
|
||||||
},
|
},
|
||||||
@ -49,8 +49,8 @@
|
|||||||
"lws-mock-response": "^0.1.0",
|
"lws-mock-response": "^0.1.0",
|
||||||
"lws-rewrite": "^0.1.0",
|
"lws-rewrite": "^0.1.0",
|
||||||
"lws-spa": "^0.1.0",
|
"lws-spa": "^0.1.0",
|
||||||
"lws-static": "^0.1.0",
|
"lws-static": "^0.1.1",
|
||||||
"lws": "^1.0.0-pre.2"
|
"lws": "^1.0.0-pre.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"test-runner": "^0.3.0"
|
"test-runner": "^0.3.0"
|
||||||
|
Reference in New Issue
Block a user