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
{{ message }}
This repository was archived by the owner on Mar 28, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+5-23Lines changed: 5 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,6 @@
8
8
9
9
Mocks server with extensible fixtures groupables in predefined behaviors. Behavior can be changed using built-in CLI or REST API.
10
10
11
-
## Table of contents
12
-
13
-
-[Getting started](#getting-started)
14
-
-[Installation](#installation)
15
-
-[Usage](#usage)
16
-
- [Interactive CLI](#interactive-cli)
17
-
-[Rest Api](#rest-api)
18
-
- [Programmatic usage](#programmatic-usage)
19
-
- [CLI](#cli)
20
-
- [Server](#server)
21
-
- [Global usage](#global-usage)
22
-
-[Options](#Options)
23
-
-[Defining mocks](#defining-mocks)
24
-
25
11
## Getting Started
26
12
27
13
This package provides a server that simulates API behaviors. As input, it needs "fixtures", which are responses for specific uris, and "behaviors", which are sets of "fixtures".
@@ -36,8 +22,6 @@ npm i @mocks-server/main --save-dev
36
22
37
23
## Usage
38
24
39
-
### Interactive CLI
40
-
41
25
Add an script to your `package.json` file, including the path to your mocks folder:
42
26
43
27
```json
@@ -163,7 +147,7 @@ module.exports = {
163
147
};
164
148
```
165
149
166
-
###REST API
150
+
## REST API
167
151
168
152
The server includes a REST API that allows to change dinamically the current behavior, change delay time, etc. This is __very useful when running acceptance tests, as you can change the behavior of the api__ simply with a request in your tests `before` method.
169
153
@@ -178,9 +162,7 @@ Available api resources are:
178
162
*`PUT``/mocks/settings` Change current server settings.
179
163
* Request body example: `{ "delay": 3000 }`
180
164
181
-
### Programmatic usage
182
-
183
-
#### Server
165
+
## Programmatic usage
184
166
185
167
The server can be instantiated and started programmatically:
First argument is mandatory, and has to be a path to a folder containing "behaviors" and "fixtures". All files in the folder will be loaded recursively, including subfolders.
208
190
For second argument options, please read the [options](#options) chapter of this documentation.
@@ -223,7 +205,7 @@ Available getters are:
223
205
224
206
> The interactive CLI can be started programatically too. Read the [cli advanced docs](./docs/cli.md) for further info.
225
207
226
-
###Global usage
208
+
## Global usage
227
209
228
210
The mocks server can be used as a global dependency as well:
229
211
@@ -237,7 +219,7 @@ Now, you can start the built-in command line interface from anywhere, providing
237
219
mocks-server --behaviors=./path-to-behaviors
238
220
```
239
221
240
-
###Support (OS Terminals)
222
+
## Support (OS Terminals)
241
223
242
224
This package uses [inquirer][inquirer-url] for displaying CLI. You can [consult his OS Terminals support here][inquirer-support].
0 commit comments