Browse Source

readme

master
Lloyd Brookes 5 years ago
parent
commit
329040e94c
  1. 6
      README.md
  2. 15
      index.js

6
README.md

@ -31,9 +31,11 @@ Running `ws` without any arguments will host the current directory as a static w
```sh
$ ws
Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
Listening on http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
```
This clip demonstrates static hosting plus a couple of log output formats - `dev` and `stats`.
<img src="https://imgur.com/download/NJC3POY" width="618px" title="Static static log output">
@ -51,6 +53,8 @@ With a static site, requests for typical SPA paths (e.g. `/user/1`, `/login`) wo
[SPA tutorial](https://github.com/lwsjs/local-web-server/wiki/How-to-serve-a-Single-Page-Application-(SPA)).
<img src="https://imgur.com/download/IQVmi8v" title="SPA">
### URL rewriting and proxied requests
Another common use case is to forward certain requests to a remote server.

15
index.js

@ -2,21 +2,6 @@ const Lws = require('lws')
/**
* @module local-web-server
* @emits module:local-web-server#verbose
* @example
* const LocalWebServer = require('local-web-server')
* const localWebServer = new LocalWebServer()
* const server = localWebServer.listen({
* port: 8050,
* https: true,
* directory: 'src',
* spa: 'index.html',
* websocket: 'src/websocket-server.js'
* })
* // secure, SPA server with listening websocket now ready on port 8050
*
* // shut down the server
* server.close()
*/
/**

Loading…
Cancel
Save