|
5 | 5 | [![NPM downloads][npm-downloads-image]][npm-downloads-url] [![License][license-image]][license-url] |
6 | 6 |
|
7 | 7 |
|
8 | | -# [![Mocks Server][logo-url]][website-url] Mocks Server |
| 8 | +# [![Mocks Server][logo-url]][website-url] Mocks Server Plugin Admin Api |
9 | 9 |
|
10 | | -This package provides a server that simulates API behaviors. It can be added as a dependency of your project, and started simply running an NPM command. |
| 10 | +Plugin for [Mocks Server][website-url] that provides an API REST that allows to change dinamically the current behavior, change delay time, and another [Mocks Server options][options-url]. |
11 | 11 |
|
12 | | -## Documentation |
| 12 | +This is __very useful when running acceptance tests, as you can change the behavior of the api__ simply making an HTTP request in your tests `before` method, for example. |
13 | 13 |
|
14 | | -Please refer to the [project documentation website][website-url]: |
| 14 | +## Usage |
15 | 15 |
|
16 | | -* [Get started](https://www.mocks-server.org/docs/get-started-intro) |
17 | | -* [Tutorials](https://www.mocks-server.org/docs/tutorials-static) |
18 | | -* [Configuration](https://www.mocks-server.org/docs/configuration-command-line-arguments) |
| 16 | +This plugin is included in the [main distribution of the Mocks Server project][main-distribution-url], so you can refer to the [official documentation website][website-url]. |
19 | 17 |
|
20 | | -## Why a mocks server? |
| 18 | +## API Resources |
21 | 19 |
|
22 | | -Controlling the responses of the api will improve the front-end development workflow, avoiding early dependencies with back-end. It also improves the testing and development of error cases or another cases that are commonly hard to reproduce in the real api. |
| 20 | +Available api resources are: |
23 | 21 |
|
24 | | -Defining the api responses during the earliest phases of development will improve the communication among team members and align their expectations. |
25 | | - |
26 | | -Working with Node.js, it integrates better in front-end projects as any other NPM dependency, and it will be easier for front-end developers to maintain the mocks. |
| 22 | +* `GET` `/mocks/behaviors/current` Returns current behavior. |
| 23 | +* `PUT` `/mocks/behaviors/current` Set current behavior. |
| 24 | + * Request body example: `{ "name": "behavior-name" }` |
| 25 | +* `GET` `/mocks/settings` Returns current server settings. |
| 26 | + * Response body example: `{ "delay": 0 }` |
| 27 | +* `PUT` `/mocks/settings` Changes current server settings. |
| 28 | + * Request body example: `{ "delay": 3000 }` |
27 | 29 |
|
28 | 30 | ## Contributing |
29 | 31 |
|
30 | 32 | Contributors are welcome. |
31 | 33 | Please read the [contributing guidelines](.github/CONTRIBUTING.md) and [code of conduct](.github/CODE_OF_CONDUCT.md). |
32 | 34 |
|
33 | 35 | [website-url]: https://www.mocks-server.org |
| 36 | +[main-distribution-url]: https://www.npmjs.com/package/@mocks-server/main |
| 37 | +[options-url]: https://www.mocks-server.org/docs/configuration-options |
34 | 38 | [logo-url]: https://www.mocks-server.org/img/logo_120.png |
35 | | -[inquirer-url]: https://www.npmjs.com/package/inquirer#support-os-terminals |
36 | | -[inquirer-support]: https://www.npmjs.com/package/inquirer#support-os-terminals |
37 | | - |
38 | | -[coveralls-image]: https://coveralls.io/repos/github/mocks-server/main/badge.svg |
39 | | -[coveralls-url]: https://coveralls.io/github/mocks-server/main |
40 | | -[travisci-image]: https://travis-ci.com/mocks-server/main.svg?branch=master |
41 | | -[travisci-url]: https://travis-ci.com/mocks-server/main |
42 | | -[last-commit-image]: https://img.shields.io/github/last-commit/mocks-server/main.svg |
43 | | -[last-commit-url]: https://github.com/mocks-server/main/commits |
44 | | -[license-image]: https://img.shields.io/npm/l/@mocks-server/main.svg |
45 | | -[license-url]: https://github.com/mocks-server/main/blob/master/LICENSE |
46 | | -[npm-downloads-image]: https://img.shields.io/npm/dm/@mocks-server/main.svg |
47 | | -[npm-downloads-url]: https://www.npmjs.com/package/@mocks-server/main |
48 | | -[npm-dependencies-image]: https://img.shields.io/david/mocks-server/main.svg |
49 | | -[npm-dependencies-url]: https://david-dm.org/mocks-server/main |
50 | | -[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server-main&metric=alert_status |
51 | | -[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server-main |
52 | | -[release-image]: https://img.shields.io/github/release-date/mocks-server/main.svg |
53 | | -[release-url]: https://github.com/mocks-server/main/releases |
| 39 | + |
| 40 | +[coveralls-image]: https://coveralls.io/repos/github/mocks-server/plugin-admin-api/badge.svg |
| 41 | +[coveralls-url]: https://coveralls.io/github/mocks-server/plugin-admin-api |
| 42 | +[travisci-image]: https://travis-ci.com/mocks-server/plugin-admin-api.svg?branch=master |
| 43 | +[travisci-url]: https://travis-ci.com/mocks-server/plugin-admin-api |
| 44 | +[last-commit-image]: https://img.shields.io/github/last-commit/mocks-server/plugin-admin-api.svg |
| 45 | +[last-commit-url]: https://github.com/mocks-server/plugin-admin-api/commits |
| 46 | +[license-image]: https://img.shields.io/npm/l/@mocks-server/plugin-admin-api.svg |
| 47 | +[license-url]: https://github.com/mocks-server/plugin-admin-api/blob/master/LICENSE |
| 48 | +[npm-downloads-image]: https://img.shields.io/npm/dm/@mocks-server/plugin-admin-api.svg |
| 49 | +[npm-downloads-url]: https://www.npmjs.com/package/@mocks-server/plugin-admin-api |
| 50 | +[npm-dependencies-image]: https://img.shields.io/david/mocks-server/plugin-admin-api.svg |
| 51 | +[npm-dependencies-url]: https://david-dm.org/mocks-server/plugin-admin-api |
| 52 | +[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server-plugin-admin-api&metric=alert_status |
| 53 | +[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server-plugin-admin-api |
| 54 | +[release-image]: https://img.shields.io/github/release-date/mocks-server/plugin-admin-api.svg |
| 55 | +[release-url]: https://github.com/mocks-server/plugin-admin-api/releases |
0 commit comments