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.
This package contains methods for administrating the mocks-server _(through the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api)RESTful API)_.
10
+
This package contains methods for administrating the mocks-server _(through the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api)REST API)_.
11
11
12
-
Built using [@data-provider](https://github.com/data-provider), it can be used in Node.js, browsers, and is also compatible with @data-providerconnectors, such as[@data-provider/connector-react](https://github.com/data-provider/connector-react), so can be easily integrated with frameworks.
12
+
Requests to the @mocks-server are made using [cross-fetch](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [@mocks-server/admin-api-client-data-providerpackage](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses[@data-provider](https://github.com/data-provider), and works well with Redux, React, etc.
> The umd distribution is bundled with the "cross-env" dependency, but requires the "@mocks-server/admin-api-paths" dependency to be added separately.
28
+
29
+
## Usage
15
30
16
31
All methods described in the [Api](#api) (expect the `config` method) return Promises when executed:
17
32
@@ -35,21 +50,15 @@ const example = async () => {
35
50
example();
36
51
```
37
52
38
-
## Usage with data-provider
39
-
40
-
Exported properties `about`, `settings`, `behaviors`, `behaviorsModel`, `fixtures` and `fixturesModel` are [@data-provider/axios](https://github.com/data-provider/axios) providers, so can be used to define @data-provider Selectors. Methods can also be connected to frameworks using @data-provider connectors, such as [@data-provider/connector-react](https://github.com/data-provider/connector-react).
41
-
42
53
## Api
43
54
44
55
*`about.read()` - Returns info about mocks-server/plugin-admin-api, such as current version.
45
56
*`settings.read()` - Returns current @mocks-server settings.
46
57
*`settings.update(settingsObject)` - Updates @mocks-server settings. A settings object has to be provided. Read the [@mocks-server configuration documentation](https://www.mocks-server.org/docs/configuration-options) for further info.
47
58
*`behaviors.read()` - Returns collection of available behaviors.
48
59
*`behavior(behaviorName).read()` - Returns an specific behavior.
49
-
*`behaviorsModel.byName(behaviorName).read()` - Returns an specific behavior.
50
60
*`fixtures.read()` - Returns collection of available fixtures.
51
61
*`fixture(fixtureId).read()` - Returns an specific fixture.
52
-
*`fixturesModel.byId(fixtureId).read()` - Returns an specific fixture.
0 commit comments