@gasket/plugin-fastify 7.0.0-next.41 → 7.0.0-next.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -23
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,26 +6,22 @@ Adds Fastify to your application.
|
|
|
6
6
|
|
|
7
7
|
#### New apps
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
gasket create <app-name> --plugins @gasket/plugin-fastify
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
#### Existing apps
|
|
14
|
-
|
|
15
9
|
```
|
|
16
10
|
npm i @gasket/plugin-fastify
|
|
17
11
|
```
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
Update your `gasket` file plugin configuration:
|
|
20
14
|
|
|
21
15
|
```diff
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
// gasket.js
|
|
17
|
+
|
|
18
|
+
+ import pluginFastify from '@gasket/plugin-fastify';
|
|
19
|
+
|
|
20
|
+
export default makeGasket({
|
|
21
|
+
plugins: [
|
|
22
|
+
+ pluginFastify
|
|
23
|
+
]
|
|
24
|
+
});
|
|
29
25
|
```
|
|
30
26
|
|
|
31
27
|
## Configuration
|
|
@@ -39,17 +35,17 @@ All the configurations for the plugin are added under `fastify` in the config:
|
|
|
39
35
|
#### Example configuration
|
|
40
36
|
|
|
41
37
|
```js
|
|
42
|
-
|
|
43
|
-
plugins:
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
export default makeGasket({
|
|
39
|
+
plugins: [
|
|
40
|
+
pluginFastify
|
|
41
|
+
],
|
|
46
42
|
fastify: {
|
|
47
43
|
compression: false,
|
|
48
44
|
routes: 'api/*.js',
|
|
49
45
|
excludedRoutesRegex: /^(?!\/_next\/)/,
|
|
50
46
|
trustProxy: true
|
|
51
47
|
}
|
|
52
|
-
}
|
|
48
|
+
});
|
|
53
49
|
```
|
|
54
50
|
|
|
55
51
|
## Lifecycles
|
|
@@ -60,7 +56,8 @@ Executed **after** the `middleware` event for when you need full control over
|
|
|
60
56
|
the `fastify` instance.
|
|
61
57
|
|
|
62
58
|
```js
|
|
63
|
-
|
|
59
|
+
export default {
|
|
60
|
+
name: 'sample-plugin',
|
|
64
61
|
hooks: {
|
|
65
62
|
/**
|
|
66
63
|
* Update Fastify app instance
|
|
@@ -72,7 +69,7 @@ module.exports = {
|
|
|
72
69
|
fastify: async function (gasket, fastify) {
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
}
|
|
72
|
+
};
|
|
76
73
|
```
|
|
77
74
|
|
|
78
75
|
### errorMiddleware
|
|
@@ -81,7 +78,8 @@ Executed after the `fastify` event. All middleware functions returned from this
|
|
|
81
78
|
hook will be applied to Fastify.
|
|
82
79
|
|
|
83
80
|
```js
|
|
84
|
-
|
|
81
|
+
export default {
|
|
82
|
+
name: 'sample-plugin',
|
|
85
83
|
hooks: {
|
|
86
84
|
/**
|
|
87
85
|
* Add Fastify error middlewares
|
|
@@ -92,7 +90,7 @@ module.exports = {
|
|
|
92
90
|
errorMiddleware: function (gasket) {
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
}
|
|
93
|
+
};
|
|
96
94
|
```
|
|
97
95
|
|
|
98
96
|
## How it works
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-fastify",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.44",
|
|
4
4
|
"description": "Adds fastify support to your application",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-fastify",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@gasket/core": "^7.0.0-next.
|
|
42
|
+
"@gasket/core": "^7.0.0-next.44",
|
|
43
43
|
"cross-env": "^7.0.3",
|
|
44
44
|
"eslint": "^8.56.0",
|
|
45
45
|
"eslint-config-godaddy": "^7.1.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"eslintIgnore": [
|
|
71
71
|
"generator"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "3a1d51a5e98ce4bad06faa2fceae90c580c8a0a9"
|
|
74
74
|
}
|