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
Copy file name to clipboardExpand all lines: src/guide/1/essentials/plugins/index.md
+15-23Lines changed: 15 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,31 +12,31 @@ For example, imagine you are developing a mobile application that accesses a **t
12
12
13
13
Kuzzle's **[Plugin Engine]({{ site_base_path }}plugins/1)** is a powerful feature that ensures that Kuzzle meets any project requirement:
14
14
15
-
* select from a set of prebuilt plugins (such as the [OAuth2 Authentication Plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-oauth) or the [MQTT Protocol](https://github.com/kuzzleio/protocol-mqtt)).
16
-
*[create your own plugin]({{ site_base_path }}plugins/1/essentials) to meet your specific requirements.
15
+
- select from a set of prebuilt plugins (such as the [OAuth2 Authentication Plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-oauth) or the [MQTT Protocol](https://github.com/kuzzleio/protocol-mqtt)).
16
+
-[create your own plugin]({{ site_base_path }}plugins/1/essentials) to meet your specific requirements.
17
17
18
18
---
19
19
20
20
## Plugins
21
21
22
22
Plugins are used to extend Kuzzle's functionalities. They are loaded into Kuzzle during startup and share its execution thread. A plugin can implement one or multiple of the following interfaces:
23
23
24
-
[Hooks]({{ site_base_path }}plugins/1/essentials/hooks): adds asynchronous listeners that perform operations triggered by data events. When a listened event occurs, the data is sent to the listeners and Kuzzle continues its process without waiting for the listener to complete.
24
+
[Hooks]({{ site_base_path }}plugins/1/hooks): adds asynchronous listeners that perform operations triggered by data events. When a listened event occurs, the data is sent to the listeners and Kuzzle continues its process without waiting for the listener to complete.
25
25
26
-
_Example - "Write a log to a third-party logging service every time a document is deleted"_. The [Logger Plugin](https://github.com/kuzzleio/kuzzle-plugin-logger) (shipped with Kuzzle) uses this feature to log all the data-related events.
26
+
_Example - "Write a log to a third-party logging service every time a document is deleted"_. The [Logger Plugin](https://github.com/kuzzleio/kuzzle-plugin-logger) (shipped with Kuzzle) uses this feature to log all the data-related events.
27
27
28
-
[Pipes]({{ site_base_path }}plugins/1/essentials/pipes): adds synchronous listeners that perform operations triggered by data events. When a listened event occurs, the data is passed synchronously to listeners, each modifying the input data and returning the result to the next listener. Kuzzle waits until the last listener completes and returns its data. If any listener returns an error, it will interrupt the Kuzzle lifecycle, and the thrown error will be used as a response by Kuzzle.
28
+
[Pipes]({{ site_base_path }}plugins/1/pipes): adds synchronous listeners that perform operations triggered by data events. When a listened event occurs, the data is passed synchronously to listeners, each modifying the input data and returning the result to the next listener. Kuzzle waits until the last listener completes and returns its data. If any listener returns an error, it will interrupt the Kuzzle lifecycle, and the thrown error will be used as a response by Kuzzle.
29
29
30
-
_Example - "Compare the ordered quantity with the available stock and return an error if the amount of ordered items exceeds the amount in stock"_.
30
+
_Example - "Compare the ordered quantity with the available stock and return an error if the amount of ordered items exceeds the amount in stock"_.
_Example - "Expose a `checkout` API endpoint that handles a third-party payment process"_.
34
+
_Example - "Expose a `checkout` API endpoint that handles a third-party payment process"_.
35
35
36
36
[Strategies]({{ site_base_path }}plugins/1/essentials/strategies): add an authentication strategy to identify and authenticate users.
37
37
38
-
_Example - "Enable OAuth based authentication in Kuzzle"_
39
-
Kuzzle ships with the [Local Strategy Plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-local) and thanks to PassportJS, more than 300 authentication strategies are readily available.
38
+
_Example - "Enable OAuth based authentication in Kuzzle"_
39
+
Kuzzle ships with the [Local Strategy Plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-local) and thanks to PassportJS, more than 300 authentication strategies are readily available.
40
40
41
41
## Protocols
42
42
@@ -61,10 +61,8 @@ Prior to loading the plugin into Kuzzle, you will need to load all of the plugin
61
61
62
62
To demonstrate, we are going to install the [**Plugin Boilerplate**](https://github.com/kuzzleio/kuzzle-core-plugin-boilerplate), a plugin example that uses all features available to a plugin.
63
63
64
-
65
64
Go to the Kuzzle installation folder and type:
66
65
67
-
68
66
```bash
69
67
# Open plugins/available folder
70
68
cd plugins/available
@@ -105,13 +103,8 @@ Once Kuzzle has restarted, check the server information at `http://localhost:751
Copy file name to clipboardExpand all lines: src/plugins/1/accessors/trigger/index.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,23 +9,22 @@ title: trigger
9
9
10
10
Triggers a custom event.
11
11
12
-
This allows interactions with other plugins using [hooks]({{ site_base_path }}plugins/1/essentials/hooks/) or [pipes]({{ site_base_path }}plugins/1/essentials/pipes/).
12
+
This allows interactions with other plugins using [hooks]({{ site_base_path }}plugins/1/hooks/) or [pipes]({{ site_base_path }}plugins/1/pipes/).
Copy file name to clipboardExpand all lines: src/plugins/1/controllers/Documentation/index.md
+35-21Lines changed: 35 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
2
layout: full.html.hbs
3
-
title: Controllers
3
+
title: Documentation
4
4
order: 400
5
5
---
6
6
7
7
# Controllers
8
8
9
9
Kuzzle's API is divided into controllers, each exposing executable actions (see [API reference]({{ site_base_path }}api/1/essentials/query-syntax)).
10
10
11
-
Plugins can extend Kuzzle's API by adding new controllers to it.
11
+
Plugins can extend Kuzzle's API by adding new controllers to it.
12
12
13
13
[Security access]({{ site_base_path }}guide/1/essentials/security/) to plugin controllers must be given (or denied), using the exact same way as with native API controllers.
14
14
@@ -21,7 +21,7 @@ To avoid naming conflicts, Kuzzle prefixes plugin controllers names with the plu
21
21
### HTTP
22
22
23
23
```http
24
-
URL: http://<server>:<port>/_plugin/<plugin name>/<url defined by the plugin>/<resources>
24
+
URL: http://<server>:<port>/_plugin/<plugin name>/<url defined by the plugin>/<resources>
25
25
Method: <verb defined by the plugin>
26
26
```
27
27
@@ -53,16 +53,17 @@ Kuzzle normalizes [queries]({{ site_base_path }}api/1/essentials/query-syntax) i
53
53
54
54
Quick summary of how queries are normalized:
55
55
56
-
* HTTP:
57
-
* dynamic arguments provided in the URL, and query string arguments are stored in `request.input.args`
58
-
* the body content is made available in `request.input.body`
59
-
* if the URL contains an `index`, a `collection` or a `_id` argument, it will be stored in `request.input.resource`
60
-
* request headers can be found in `request.context.connection.misc.headers`
56
+
- HTTP:
61
57
62
-
* Other protocols:
63
-
* the `body` property is stored in `request.input.body`
64
-
* these root properties are available in `request.input.resource`: `index`, `collection`, `_id`
65
-
* any other properties at the root of the query object will be stored in `request.input.args`
58
+
- dynamic arguments provided in the URL, and query string arguments are stored in `request.input.args`
59
+
- the body content is made available in `request.input.body`
60
+
- if the URL contains an `index`, a `collection` or a `_id` argument, it will be stored in `request.input.resource`
61
+
- request headers can be found in `request.context.connection.misc.headers`
62
+
63
+
- Other protocols:
64
+
- the `body` property is stored in `request.input.body`
65
+
- these root properties are available in `request.input.resource`: `index`, `collection`, `_id`
66
+
- any other properties at the root of the query object will be stored in `request.input.args`
66
67
67
68
---
68
69
@@ -78,7 +79,7 @@ Read more about these automatic controller events [here]({{ site_base_path }}plu
78
79
79
80
```javascript
80
81
module.exports=classControllerPlugin {
81
-
constructor() {
82
+
constructor() {
82
83
/*
83
84
Adds a new "newController" controller to Kuzzle's API.
84
85
@@ -128,16 +129,26 @@ module.exports = class ControllerPlugin {
0 commit comments