Skip to content

Commit 654a0f5

Browse files
committed
Reorganize the api-overview page
1 parent 1a2d9ca commit 654a0f5

File tree

1 file changed

+43
-28
lines changed

1 file changed

+43
-28
lines changed

docs/api-overview.md

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: API Overview
3+
sidebarDepth: 3
34
---
45

56
<!--- Usage ------------------------------------------------------------------------------------ -->
@@ -53,29 +54,43 @@ npm install feathers-vuex --save
5354
yarn add feathers-vuex
5455
```
5556

56-
## Use
57+
### With feathers-socketio
5758

58-
Using Feathers-Vuex happens in these steps:
59+
A realtime-transport like Socket.io or Primus is required in order to take advantage of the real-time socket events built into Feathers-Vuex. The `feathers-hooks-common` package, specified below, is not required to work with Feathers-Vuex.
5960

60-
1. [Setup the Feathers client and Feathers-Vuex](#setup-the-feathers-client-and-feathers-vuex)
61-
2. [Define a Model class and service plugin for each service](#setup-one-or-more-service-plugins)
62-
3. [Setup the auth plugin](#setup-the-auth-plugin), if required.
63-
4. Register the plugins with the Vuex store.
61+
```bash
62+
npm i @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client socket.io-client feathers-vuex feathers-hooks-common --save
63+
```
6464

65-
### Setup the Feathers Client and Feathers-Vuex
65+
```bash
66+
yarn add @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client socket.io-client feathers-vuex feathers-hooks-common
67+
```
6668

67-
To setup `feathers-vuex`, we first need to setup the latest Feathers client. We can also setup feathers-vuex in the same file.
69+
### With feathers-rest
6870

69-
First, let's install dependencies.
71+
Feathers-Vuex works with Feathers-Rest, but keep in mind that the `feathers-rest` client does not listen to socket events. The `feathers-hooks-common` package, specified below, is not required to work with Feathers-Vuex.
7072

7173
```bash
72-
npm i @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client feathers-hooks-common socket.io-client feathers-vuex --save
74+
npm i @feathersjs/feathers @feathersjs/rest-client @feathersjs/authentication-client feathers-hooks-common feathers-vuex --save
7375
```
7476

7577
```bash
76-
yarn add @feathersjs/feathers @feathersjs/socketio-client @feathersjs/authentication-client feathers-hooks-common socket.io-client feathers-vuex
78+
yarn add @feathersjs/feathers @feathersjs/rest-client @feathersjs/authentication-client feathers-hooks-common feathers-vuex
7779
```
7880

81+
## Setup
82+
83+
Using Feathers-Vuex happens in these steps:
84+
85+
1. [Setup the Feathers client and Feathers-Vuex](#setup-the-feathers-client-and-feathers-vuex)
86+
2. [Define a Model class and service plugin for each service](#setup-one-or-more-service-plugins)
87+
3. [Setup the auth plugin](#setup-the-auth-plugin), if required.
88+
4. Register the plugins with the Vuex store.
89+
90+
### Feathers Client & Feathers-Vuex
91+
92+
To setup `feathers-vuex`, we first need to setup the latest Feathers client. We can also setup feathers-vuex in the same file. Depending on your requirements, you'll need to install the feathers-client dependencies, as shown, above.
93+
7994
Note that this example includes an app-level hook that removes attributes for handling temporary (local-only) records.
8095

8196
```js
@@ -117,7 +132,7 @@ const { makeServicePlugin, makeAuthPlugin, BaseModel, models } = feathersVuex(
117132
export { makeAuthPlugin, makeServicePlugin, BaseModel, models }
118133
```
119134

120-
### Setup one or more service plugins
135+
### Service Plugins
121136

122137
The following example creates a User class and registers it with the new `makeServicePlugin` utility function. This same file is also a great place to add your service-level hooks, so they're shown, too.
123138

@@ -180,7 +195,7 @@ feathersClient.service(servicePath).hooks({
180195
export default servicePlugin
181196
```
182197

183-
### Setup the Auth Plugin
198+
### Auth Plugin
184199

185200
If your application uses authentication, the Auth Plugin will probably come in handy. It's a couple of lines to setup:
186201

@@ -193,7 +208,7 @@ export default makeAuthPlugin({ userService: 'users' })
193208

194209
[Read more about the Auth Plugin](/auth-plugin.html).
195210

196-
### Add the plugins to the Vuex store.
211+
### Vuex store
197212

198213
```js
199214
// src/store/store.js
@@ -223,18 +238,20 @@ export default new Vuex.Store({
223238
actions: {},
224239
plugins: [...servicePlugins, auth]
225240
})
226-
227241
```
228242

229-
The new `feathers-vuex` API is more Vuex-like. All of the functionality remains the same, but it is no longer configured like a FeathersJS plugin. While the previous functionality was nice for prototyping, it didn't work well in SSR scenarios, like with Nuxt.
243+
## Begin Using Feathers-Vuex
230244

231-
To see `feathers-vuex` in a working vue-cli application, check out [`feathers-chat-vuex`](https://github.com/feathers-plus/feathers-chat-vuex).
245+
There are a couple of ways to use Feathers-Vuex. Version 2.0 heavily focuses on abstracting away the Vuex syntax in favor of using [Model classes](/model-classes.html). The Model classes are a layer on top of the Vuex getters, mutations, and actions. You can, of course, also directly use the [service plugin's getters, mutations, and actions](/service-plugin.html).
232246

233-
## Note about feathers-reactive
247+
There are two plugins included:
234248

235-
Previous versions of this plugin required both RxJS and `feathers-reactive` to receive realtime updates. `[email protected]` has socket messaging support built in and takes advantage of Vuex reactivity, so RxJS and `feathers-reactive` are no longer required or supported.
249+
1. The [Service Plugin](./service-plugin.md) adds a Vuex store for new services.
250+
2. The [Auth Plugin](./auth-plugin.md) sets up the Vuex store for authentication / logout.
251+
252+
To see `feathers-vuex` in a working vue-cli application, check out [`feathers-chat-vuex`](https://github.com/feathers-plus/feathers-chat-vuex).
236253

237-
## Global Configuration
254+
### Global Configuration
238255

239256
The following default options are available for configuration:
240257

@@ -248,17 +265,15 @@ const defaultOptions = {
248265
}
249266
```
250267

251-
Each service module can also be individually configured.
252-
253-
## The Vuex Plugins
268+
### Note about feathers-reactive
254269

255-
There are two plugins included:
270+
Previous versions of this plugin required both RxJS and `feathers-reactive` to receive realtime updates. `[email protected]` has socket messaging support built in and takes advantage of Vuex reactivity, so RxJS and `feathers-reactive` are no longer required or supported.
256271

257-
1. The [Service Plugin](./service-plugin.md) adds a Vuex store for new services.
258-
2. The [Auth Plugin](./auth-plugin.md) sets up the Vuex store for authentication / logout.
272+
Each service module can also be individually configured.
259273

260274
## License
261275

262-
Copyright (c) Forever, or at least the current year.
263-
264276
Licensed under the [MIT license](LICENSE).
277+
278+
Feathers-Vuex is developed and maintained by [Marshall Thompson](https://www.github.com/marshallswain).
279+

0 commit comments

Comments
 (0)