You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+21-20
Original file line number
Diff line number
Diff line change
@@ -9,35 +9,36 @@
9
9
10
10
# local-web-server
11
11
12
-
The modular web server for productive full-stack development.
12
+
A modular HTTP, HTTPS and HTTP2 command-line web server for productive full-stack development. Local-web-server is a distribution of [lws](https://github.com/lwsjs/lws) bundled with a "starter pack" of useful middleware.
13
13
14
14
Use this tool to:
15
15
16
-
* Build any flavour of web application (static site, dynamic site with client or server-rendered content, Single Page App, Progessive Web App, Angular or React app etc.)
17
-
* Prototype any CORS-enabled back-end service (e.g. RESTful HTTP API or Microservice using websockets, Server Sent Events etc.)
18
-
* Monitor activity, analyse performance, experiment with caching strategies etc.
19
-
* Build your own, personalised CLI web server tool
16
+
* Help build any flavour of front-end web application
17
+
**Static site, dynamic site with client or server-rendered content, Single Page App, Progessive Web App, Angular or React app etc.*
18
+
* Prototype a CORS-enabled back-end service
19
+
**RESTful HTTP API, microservice, websocket server, Server Sent Events service etc.*
20
+
* Monitor activity, analyse performance, fine-tune caching strategy etc.
20
21
21
22
Features:
22
23
23
-
* Modular, extensible and easy to personalise. Create, share and consume only plugins which match your requirements.
24
-
* Powerful, extensible command-line interface (add your own commands and options)
25
-
* HTTP, HTTPS and HTTP2 support (HTTP2 requires node v8.4.0 or above)
26
-
* URL Rewriting to local or remote destinations
27
-
* Single Page Application support
28
-
* Response mocking
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
29
32
* Configurable access log
30
-
* Route blacklisting
31
-
* HTTP Conditional and Range request support
32
-
* Gzip response compression, HTTP Basic Authentication and much more
33
+
* Route blacklisting and more
33
34
34
35
## Synopsis
35
36
36
37
This package installs the `ws` command-line tool (take a look at the [usage guide](https://github.com/lwsjs/local-web-server/wiki/CLI-usage)).
37
38
38
39
### Static web site
39
40
40
-
The most simple use case is to run `ws` without any arguments - this will **host the current directory as a static web site**. Navigating to the server will render a directory listing or your `index.html`, if that file exists.
41
+
Running `ws` without any arguments will host the current directory as a static web site. Navigating to the server will render a directory listing or your `index.html`, if that file exists.
41
42
42
43
```sh
43
44
$ ws
@@ -53,15 +54,15 @@ $ ws --spa index.html
53
54
Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
54
55
```
55
56
56
-
By default, requests for typical SPA paths (e.g. `/user/1`, `/login`) return `404 Not Found` as a file at that location does not exist. By marking `index.html` as the SPA you create this rule:
57
+
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:
57
58
58
59
*If a static file is requested (e.g. `/css/style.css`) then serve it, if not (e.g. `/login`) then serve the specified SPA and handle the route client-side.*
Another common use case is to **re-route certain requests to a remote server** if, for example, you'd like to use data from a different environment. The following command would proxy requests with a URL beginning with `http://127.0.0.1:8000/api/`to `https://internal-service.local/api/`:
65
+
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`.
@@ -70,7 +71,7 @@ Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:80
70
71
71
72
### HTTPS
72
73
73
-
Launching a secure server is as simple as setting the `--https` flag. [See the wiki](https://github.com/lwsjs/local-web-server/wiki) for further configuration options and a guide on how to get the "green padlock" in your browser.
74
+
Launch a secure server by setting the `--https` flag. [See the wiki](https://github.com/lwsjs/local-web-server/wiki) for further configuration options and a guide on how to get the "green padlock" in your browser.
74
75
75
76
```sh
76
77
$ ws --https
@@ -79,7 +80,7 @@ Serving at https://mbp.local:8000, https://127.0.0.1:8000, https://192.168.0.100
79
80
80
81
### HTTP2
81
82
82
-
Uses node's built-in HTTP2 support. HTTP2 servers are always secure using local-web-server's built-in SSL certificates (by default) or those supplied by `--cert`, `--key` or `--pfx`. [See the wiki](https://github.com/lwsjs/local-web-server/wiki) for further info about HTTPS options and a guide on how to get the "green padlock" in your browser.
83
+
Uses node's built-in HTTP2 support. [See the wiki](https://github.com/lwsjs/local-web-server/wiki) for further info about HTTPS options and a guide on how to get the "green padlock" in your browser.
0 commit comments