Skip to content

Commit 1998b90

Browse files
committedJun 8, 2019
readme
1 parent c9a6101 commit 1998b90

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed
 

‎README.md

+20-19
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ Use this tool to:
1919
* *RESTful HTTP API, microservice, websocket server, Server Sent Events service etc.*
2020
* Monitor activity, analyse performance, fine-tune caching strategy etc.
2121

22-
Features:
23-
24-
* Full control over the middleware stack
25-
* Single Page Application (SPA) support
26-
* URL Rewriting
27-
* Proxy requests to remote resources
28-
* HTTP Conditional Request support
29-
* Range request support
30-
* Gzip response compression
31-
* HTTP Basic Authentication
32-
* Configurable access log
33-
* Route blacklisting and more
34-
3522
Local-web-server is a distribution of [lws](https://github.com/lwsjs/lws) bundled with a "starter pack" of useful middleware.
3623

3724
## Synopsis
@@ -56,7 +43,6 @@ Serving a Single Page Application (an app with client-side routing, e.g. a React
5643

5744
```sh
5845
$ ws --spa index.html
59-
Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
6046
```
6147

6248
With a static site, requests for typical SPA paths (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file at that location does not exist. However, by marking `index.html` as the SPA you create this rule:
@@ -67,13 +53,16 @@ With a static site, requests for typical SPA paths (e.g. `/user/1`, `/login`) wo
6753

6854
### URL rewriting and proxied requests
6955

70-
Another common use case is to forward certain requests to a remote server. The following command would proxy requests from any URL beginning with `/api/` to `https://internal-service.local/api/`. For example, a request to `/api/posts/1` would be proxied to `https://internal-service.local/api/posts/1`.
56+
Another common use case is to forward certain requests to a remote server.
57+
58+
The following command proxies blog post requests from any path beginning with `/posts/` to `https://jsonplaceholder.typicode.com/posts/`. For example, a request for `/posts/1` would be proxied to `https://jsonplaceholder.typicode.com/posts/1`.
7159

7260
```sh
73-
$ ws --rewrite '/api/* -> https://internal-service.local/api/$1'
74-
Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
61+
$ ws --rewrite '/posts/(.*) -> https://jsonplaceholder.typicode.com/posts/$1'
7562
```
7663

64+
This clip demonstrates the above plus use of `--static.extensions` to specify a default file extension and `--verbose` to monitor activity.
65+
7766
<img src="https://imgur.com/download/3flcbJn" width="618px" title="Proxy json requests to remote resource">
7867

7968
### HTTPS
@@ -82,7 +71,6 @@ Launch a secure server by setting the `--https` flag. [See the wiki](https://git
8271

8372
```sh
8473
$ ws --https
85-
Serving at https://mbp.local:8000, https://127.0.0.1:8000, https://192.168.0.100:8000
8674
```
8775

8876
### HTTP2
@@ -91,9 +79,22 @@ Uses node's built-in HTTP2 support. [See the wiki](https://github.com/lwsjs/loca
9179

9280
```sh
9381
$ ws --http2
94-
Serving at https://mbp.local:8000, https://127.0.0.1:8000, https://192.168.0.100:8000
9582
```
9683

84+
## Features
85+
86+
* Full control over request handling. The middleware stack is personalisable - use one or more custom or pre-built middleware plugins.
87+
* Single Page Application (SPA) support
88+
* URL Rewriting
89+
* Proxy requests to remote resources
90+
* HTTP Conditional Request support
91+
* Range request support
92+
* Gzip response compression
93+
* HTTP Basic Authentication
94+
* Configurable access log
95+
* Route blacklisting and more
96+
97+
9798
## Further Documentation
9899

99100
[See the wiki for plenty more documentation and tutorials](https://github.com/lwsjs/local-web-server/wiki).

0 commit comments

Comments
 (0)
Please sign in to comment.