Skip to content

Commit 69c2def

Browse files
committedJun 6, 2019
deps, readme, remove API docs
1 parent f1c50e1 commit 69c2def

File tree

5 files changed

+32
-162
lines changed

5 files changed

+32
-162
lines changed
 

‎README.md

-63
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![Coverage Status](https://coveralls.io/repos/github/lwsjs/local-web-server/badge.svg?branch=master)](https://coveralls.io/github/lwsjs/local-web-server?branch=master)
55
[![Dependency Status](https://badgen.net/david/dep/lwsjs/local-web-server)](https://david-dm.org/lwsjs/local-web-server)
66
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
7-
[![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)
87

98
**Requires node v8 or above. Upgraders, please read the [release notes](https://github.com/lwsjs/local-web-server/releases)**.
109

@@ -87,68 +86,6 @@ $ ws --http2
8786
Serving at https://mbp.local:8000, https://127.0.0.1:8000, https://192.168.0.100:8000
8887
```
8988

90-
### Mock responses
91-
92-
Imagine the network is down or you're working offline, proxied requests to `https://internal-service.local/api/users/1` would fail. In this case, Mock Responses can fill the gap. Mocks are defined in a module which can be reused between projects.
93-
94-
Trivial example - respond to a request for `/rivers` with some JSON. Save the following Javascript in a file named `example-mocks.js`.
95-
96-
```js
97-
module.exports = MockBase => class MockRivers extends MockBase {
98-
mocks () {
99-
return {
100-
route: '/rivers',
101-
responses: [
102-
{
103-
response: {
104-
type: 'json',
105-
body: [
106-
{ name: 'Volga', drainsInto: 'Caspian Sea' },
107-
{ name: 'Danube', drainsInto: 'Black Sea' },
108-
{ name: 'Ural', drainsInto: 'Caspian Sea' },
109-
{ name: 'Dnieper', drainsInto: 'Black Sea' }
110-
]
111-
}
112-
}
113-
]
114-
}
115-
}
116-
}
117-
```
118-
119-
Launch `ws` passing in your mocks module.
120-
121-
```sh
122-
$ ws --mocks example-mocks.js
123-
Serving at http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000
124-
```
125-
126-
GET your rivers.
127-
128-
```sh
129-
$ curl http://127.0.0.1:8000/rivers
130-
[
131-
{
132-
"name": "Volga",
133-
"drainsInto": "Caspian Sea"
134-
},
135-
{
136-
"name": "Danube",
137-
"drainsInto": "Black Sea"
138-
},
139-
{
140-
"name": "Ural",
141-
"drainsInto": "Caspian Sea"
142-
},
143-
{
144-
"name": "Dnieper",
145-
"drainsInto": "Black Sea"
146-
}
147-
]
148-
```
149-
150-
See [the tutorials](https://github.com/lwsjs/local-web-server/wiki#tutorials) for more information and examples about mock responses.
151-
15289
## Further Documentation
15390

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

‎doc/api.md

-51
This file was deleted.

‎index.js

-27
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,6 @@ const Lws = require('lws')
2323
* @alias module:local-web-server
2424
*/
2525
class LocalWebServer extends Lws {
26-
/**
27-
* Returns a listening HTTP/HTTPS server.
28-
* @param [options] {object} - Server options
29-
* @param [options.port] {number} - Port
30-
* @param [options.hostname] {string} -The hostname (or IP address) to listen on. Defaults to 0.0.0.0.
31-
* @param [options.maxConnections] {number} - The maximum number of concurrent connections supported by the server.
32-
* @param [options.keepAliveTimeout] {number} - The period (in milliseconds) of inactivity a connection will remain open before being destroyed. Set to `0` to keep connections open indefinitely.
33-
* @param [options.configFile] {string} - Config file path, defaults to 'lws.config.js'.
34-
* @param [options.https] {boolean} - Enable HTTPS using a built-in key and cert registered to the domain 127.0.0.1.
35-
* @param [options.key] {string} - SSL key file path. Supply along with --cert to launch a https server.
36-
* @param [options.cert] {string} - SSL cert file path. Supply along with --key to launch a https server.
37-
* @param [options.pfx] {string} - Path to an PFX or PKCS12 encoded private key and certificate chain. An alternative to providing --key and --cert.
38-
* @param [options.ciphers] {string} - Optional cipher suite specification, replacing the default.
39-
* @param [options.secureProtocol] {string} - Optional SSL method to use, default is "SSLv23_method".
40-
* @param [options.stack] {string[]|Middlewares[]} - Array of feature classes, or filenames of modules exporting a feature class.
41-
* @param [options.moduleDir] {string[]} - One or more directories to search for modules.
42-
* @returns {Server}
43-
*/
44-
4526
getDefaultConfig () {
4627
return Object.assign(super.getDefaultConfig(), {
4728
moduleDir: [ __dirname, '.' ],
@@ -50,12 +31,4 @@ class LocalWebServer extends Lws {
5031
}
5132
}
5233

53-
/**
54-
* Highly-verbose debug information event stream.
55-
*
56-
* @event module:local-web-server#verbose
57-
* @param key {string} - An identifying string, e.g. `server.socket.data`.
58-
* @param value {*} - The value, e.g. `{ socketId: 1, bytesRead: '3 Kb' }`.
59-
*/
60-
6134
module.exports = LocalWebServer

‎package-lock.json

+23-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
"rest",
2121
"mock",
2222
"api",
23-
"proxy"
23+
"proxy",
24+
"lws",
25+
"backend",
26+
"frontend",
27+
"full-stack"
2428
],
2529
"engines": {
2630
"node": ">=8"
2731
},
2832
"scripts": {
2933
"test": "test-runner test/*.js",
30-
"docs": "jsdoc2md -p list index.js lib/*.js > doc/api.md; echo",
3134
"cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
3235
},
3336
"files": [
@@ -36,26 +39,26 @@
3639
"index.js"
3740
],
3841
"dependencies": {
39-
"lws": "2.0.0-8",
42+
"lws": "2.0.0-9",
4043
"lws-basic-auth": "^1.0.2",
4144
"lws-blacklist": "^2.0.1",
4245
"lws-body-parser": "^1.0.1",
4346
"lws-compress": "^1.0.1",
4447
"lws-conditional-get": "^1.0.0",
4548
"lws-cors": "^2.0.0",
46-
"lws-index": "^1.0.1",
49+
"lws-index": "^1.0.2",
4750
"lws-json": "^1.0.0",
4851
"lws-log": "^1.0.0",
4952
"lws-mime": "^1.0.0",
5053
"lws-range": "^2.0.0",
51-
"lws-request-monitor": "^1.0.1",
54+
"lws-request-monitor": "^1.0.3",
5255
"lws-rewrite": "^2.0.0",
5356
"lws-spa": "^2.0.0",
5457
"lws-static": "^1.1.0",
5558
"node-version-matches": "^1.0.1"
5659
},
5760
"devDependencies": {
58-
"coveralls": "^3.0.3",
61+
"coveralls": "^3.0.4",
5962
"jsdoc-to-markdown": "^5.0.0",
6063
"node-fetch": "^2.6.0",
6164
"nyc": "^14.1.1",

0 commit comments

Comments
 (0)
Please sign in to comment.