fastify 3.24.0 → 3.25.2
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 +30 -29
- package/docs/{Benchmarking.md → Guides/Benchmarking.md} +14 -5
- package/docs/Guides/Ecosystem.md +513 -0
- package/docs/{Fluent-Schema.md → Guides/Fluent-Schema.md} +16 -7
- package/docs/{Getting-Started.md → Guides/Getting-Started.md} +180 -60
- package/docs/Guides/Index.md +30 -4
- package/docs/{Migration-Guide-V3.md → Guides/Migration-Guide-V3.md} +43 -37
- package/docs/{Plugins-Guide.md → Guides/Plugins-Guide.md} +196 -82
- package/docs/{Recommendations.md → Guides/Recommendations.md} +17 -10
- package/docs/{Serverless.md → Guides/Serverless.md} +200 -42
- package/docs/Guides/Style-Guide.md +246 -0
- package/docs/{Testing.md → Guides/Testing.md} +26 -12
- package/docs/Guides/Write-Plugin.md +102 -0
- package/docs/{ContentTypeParser.md → Reference/ContentTypeParser.md} +68 -30
- package/docs/{Decorators.md → Reference/Decorators.md} +52 -47
- package/docs/{Encapsulation.md → Reference/Encapsulation.md} +3 -3
- package/docs/{Errors.md → Reference/Errors.md} +77 -47
- package/docs/{HTTP2.md → Reference/HTTP2.md} +13 -13
- package/docs/{Hooks.md → Reference/Hooks.md} +157 -70
- package/docs/Reference/Index.md +71 -0
- package/docs/{LTS.md → Reference/LTS.md} +31 -32
- package/docs/{Lifecycle.md → Reference/Lifecycle.md} +15 -7
- package/docs/{Logging.md → Reference/Logging.md} +68 -28
- package/docs/Reference/Middleware.md +78 -0
- package/docs/{Plugins.md → Reference/Plugins.md} +91 -34
- package/docs/{Reply.md → Reference/Reply.md} +205 -94
- package/docs/{Request.md → Reference/Request.md} +32 -16
- package/docs/{Routes.md → Reference/Routes.md} +243 -113
- package/docs/{Server.md → Reference/Server.md} +516 -267
- package/docs/{TypeScript.md → Reference/TypeScript.md} +451 -191
- package/docs/{Validation-and-Serialization.md → Reference/Validation-and-Serialization.md} +178 -86
- package/docs/index.md +24 -0
- package/examples/typescript-server.ts +1 -1
- package/fastify.js +2 -3
- package/lib/contentTypeParser.js +11 -6
- package/lib/decorate.js +6 -3
- package/lib/logger.js +1 -1
- package/lib/route.js +1 -1
- package/lib/server.js +9 -8
- package/package.json +9 -4
- package/test/als.test.js +74 -0
- package/test/constrained-routes.test.js +220 -0
- package/test/custom-parser.test.js +11 -2
- package/test/decorator.test.js +38 -0
- package/test/handler-context.test.js +11 -4
- package/test/http2/closing.test.js +14 -5
- package/test/http2/constraint.test.js +91 -0
- package/test/listen.test.js +36 -22
- package/test/logger.test.js +16 -0
- package/test/maxRequestsPerSocket.test.js +10 -0
- package/test/request-error.test.js +2 -8
- package/test/requestTimeout.test.js +4 -1
- package/test/router-options.test.js +10 -1
- package/test/schema-feature.test.js +146 -0
- package/test/stream.test.js +14 -3
- package/test/trust-proxy.test.js +15 -7
- package/test/types/instance.test-d.ts +52 -1
- package/test/types/request.test-d.ts +7 -1
- package/test/types/route.test-d.ts +21 -0
- package/types/hooks.d.ts +12 -1
- package/types/instance.d.ts +16 -6
- package/types/request.d.ts +4 -1
- package/types/route.d.ts +1 -1
- package/docs/Ecosystem.md +0 -211
- package/docs/Middleware.md +0 -53
- package/docs/Style-Guide.md +0 -185
- package/docs/Write-Plugin.md +0 -58
package/README.md
CHANGED
|
@@ -146,7 +146,7 @@ fastify.listen(3000, (err, address) => {
|
|
|
146
146
|
})
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Do you want to know more? Head to the <a href="./docs/Getting-Started.md"><code><b>Getting Started</b></code></a>.
|
|
149
|
+
Do you want to know more? Head to the <a href="./docs/Guides/Getting-Started.md"><code><b>Getting Started</b></code></a>.
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
### Fastify v1.x and v2.x
|
|
@@ -156,7 +156,7 @@ In a similar way, all Fastify **v2.x** related changes should be based on [**`br
|
|
|
156
156
|
|
|
157
157
|
> ## Note
|
|
158
158
|
> `.listen` binds to the local host, `localhost`, interface by default (`127.0.0.1` or `::1`, depending on the operating system configuration). If you are running Fastify in a container (Docker, [GCP](https://cloud.google.com/), etc.), you may need to bind to `0.0.0.0`. Be careful when deciding to listen on all interfaces; it comes with inherent [security risks](https://web.archive.org/web/20170711105010/https://snyk.io/blog/mongodb-hack-and-secure-defaults/).
|
|
159
|
-
> See [the documentation](./docs/Server.md#listen) for more information.
|
|
159
|
+
> See [the documentation](./docs/Reference/Server.md#listen) for more information.
|
|
160
160
|
|
|
161
161
|
### Core features
|
|
162
162
|
|
|
@@ -189,39 +189,39 @@ depends on your application, you should __always__ benchmark if performance
|
|
|
189
189
|
matters to you.
|
|
190
190
|
|
|
191
191
|
## Documentation
|
|
192
|
-
* <a href="./docs/Getting-Started.md"><code><b>Getting Started</b></code></a>
|
|
192
|
+
* <a href="./docs/Guides/Getting-Started.md"><code><b>Getting Started</b></code></a>
|
|
193
193
|
* <a href="./docs/Guides/Index.md"><code><b>Guides</b></code></a>
|
|
194
|
-
* <a href="./docs/Server.md"><code><b>Server</b></code></a>
|
|
195
|
-
* <a href="./docs/Routes.md"><code><b>Routes</b></code></a>
|
|
196
|
-
* <a href="./docs/Encapsulation.md"><code><b>Encapsulation</b></code></a>
|
|
197
|
-
* <a href="./docs/Logging.md"><code><b>Logging</b></code></a>
|
|
198
|
-
* <a href="./docs/Middleware.md"><code><b>Middleware</b></code></a>
|
|
199
|
-
* <a href="./docs/Hooks.md"><code><b>Hooks</b></code></a>
|
|
200
|
-
* <a href="./docs/Decorators.md"><code><b>Decorators</b></code></a>
|
|
201
|
-
* <a href="./docs/Validation-and-Serialization.md"><code><b>Validation and Serialization</b></code></a>
|
|
202
|
-
* <a href="./docs/Fluent-Schema.md"><code><b>Fluent Schema</b></code></a>
|
|
203
|
-
* <a href="./docs/Lifecycle.md"><code><b>Lifecycle</b></code></a>
|
|
204
|
-
* <a href="./docs/Reply.md"><code><b>Reply</b></code></a>
|
|
205
|
-
* <a href="./docs/Request.md"><code><b>Request</b></code></a>
|
|
206
|
-
* <a href="./docs/Errors.md"><code><b>Errors</b></code></a>
|
|
207
|
-
* <a href="./docs/ContentTypeParser.md"><code><b>Content Type Parser</b></code></a>
|
|
208
|
-
* <a href="./docs/Plugins.md"><code><b>Plugins</b></code></a>
|
|
209
|
-
* <a href="./docs/Testing.md"><code><b>Testing</b></code></a>
|
|
210
|
-
* <a href="./docs/Benchmarking.md"><code><b>Benchmarking</b></code></a>
|
|
211
|
-
* <a href="./docs/Write-Plugin.md"><code><b>How to write a good plugin</b></code></a>
|
|
212
|
-
* <a href="./docs/Plugins-Guide.md"><code><b>Plugins Guide</b></code></a>
|
|
213
|
-
* <a href="./docs/HTTP2.md"><code><b>HTTP2</b></code></a>
|
|
214
|
-
* <a href="./docs/LTS.md"><code><b>Long Term Support</b></code></a>
|
|
215
|
-
* <a href="./docs/TypeScript.md"><code><b>TypeScript and types support</b></code></a>
|
|
216
|
-
* <a href="./docs/Serverless.md"><code><b>Serverless</b></code></a>
|
|
217
|
-
* <a href="./docs/Recommendations.md"><code><b>Recommendations</b></code></a>
|
|
194
|
+
* <a href="./docs/Reference/Server.md"><code><b>Server</b></code></a>
|
|
195
|
+
* <a href="./docs/Reference/Routes.md"><code><b>Routes</b></code></a>
|
|
196
|
+
* <a href="./docs/Reference/Encapsulation.md"><code><b>Encapsulation</b></code></a>
|
|
197
|
+
* <a href="./docs/Reference/Logging.md"><code><b>Logging</b></code></a>
|
|
198
|
+
* <a href="./docs/Reference/Middleware.md"><code><b>Middleware</b></code></a>
|
|
199
|
+
* <a href="./docs/Reference/Hooks.md"><code><b>Hooks</b></code></a>
|
|
200
|
+
* <a href="./docs/Reference/Decorators.md"><code><b>Decorators</b></code></a>
|
|
201
|
+
* <a href="./docs/Reference/Validation-and-Serialization.md"><code><b>Validation and Serialization</b></code></a>
|
|
202
|
+
* <a href="./docs/Guides/Fluent-Schema.md"><code><b>Fluent Schema</b></code></a>
|
|
203
|
+
* <a href="./docs/Reference/Lifecycle.md"><code><b>Lifecycle</b></code></a>
|
|
204
|
+
* <a href="./docs/Reference/Reply.md"><code><b>Reply</b></code></a>
|
|
205
|
+
* <a href="./docs/Reference/Request.md"><code><b>Request</b></code></a>
|
|
206
|
+
* <a href="./docs/Reference/Errors.md"><code><b>Errors</b></code></a>
|
|
207
|
+
* <a href="./docs/Reference/ContentTypeParser.md"><code><b>Content Type Parser</b></code></a>
|
|
208
|
+
* <a href="./docs/Reference/Plugins.md"><code><b>Plugins</b></code></a>
|
|
209
|
+
* <a href="./docs/Guides/Testing.md"><code><b>Testing</b></code></a>
|
|
210
|
+
* <a href="./docs/Guides/Benchmarking.md"><code><b>Benchmarking</b></code></a>
|
|
211
|
+
* <a href="./docs/Guides/Write-Plugin.md"><code><b>How to write a good plugin</b></code></a>
|
|
212
|
+
* <a href="./docs/Guides/Plugins-Guide.md"><code><b>Plugins Guide</b></code></a>
|
|
213
|
+
* <a href="./docs/Reference/HTTP2.md"><code><b>HTTP2</b></code></a>
|
|
214
|
+
* <a href="./docs/Reference/LTS.md"><code><b>Long Term Support</b></code></a>
|
|
215
|
+
* <a href="./docs/Reference/TypeScript.md"><code><b>TypeScript and types support</b></code></a>
|
|
216
|
+
* <a href="./docs/Guides/Serverless.md"><code><b>Serverless</b></code></a>
|
|
217
|
+
* <a href="./docs/Guides/Recommendations.md"><code><b>Recommendations</b></code></a>
|
|
218
218
|
|
|
219
219
|
中文文档[地址](https://github.com/fastify/docs-chinese/blob/HEAD/README.md)
|
|
220
220
|
|
|
221
221
|
## Ecosystem
|
|
222
222
|
|
|
223
|
-
- [Core](./docs/Ecosystem.md#core) - Core plugins maintained by the _Fastify_ [team](#team).
|
|
224
|
-
- [Community](./docs/Ecosystem.md#community) - Community supported plugins.
|
|
223
|
+
- [Core](./docs/Guides/Ecosystem.md#core) - Core plugins maintained by the _Fastify_ [team](#team).
|
|
224
|
+
- [Community](./docs/Guides/Ecosystem.md#community) - Community supported plugins.
|
|
225
225
|
- [Live Examples](https://github.com/fastify/example) - Multirepo with a broad set of real working examples.
|
|
226
226
|
- [Discord](https://discord.gg/D3FZYPy) - Join our discord server and chat with the maintainers.
|
|
227
227
|
|
|
@@ -251,6 +251,7 @@ Team members are listed in alphabetical order.
|
|
|
251
251
|
* [__Rafael Gonzaga__](https://github.com/rafaelgss), <https://twitter.com/_rafaelgss>, <https://www.npmjs.com/~rafaelgss>
|
|
252
252
|
* [__Vincent Le Goff__](https://github.com/zekth)
|
|
253
253
|
* [__Luciano Mammino__](https://github.com/lmammino), <https://twitter.com/loige>, <https://www.npmjs.com/~lmammino>
|
|
254
|
+
* [__Luis Orbaiceta__](https://github.com/luisorbaiceta), <https://twitter.com/luisorbai>, <https://www.npmjs.com/~luisorbaiceta>
|
|
254
255
|
* [__Maksim Sinik__](https://github.com/fox1t), <https://twitter.com/maksimsinik>, <https://www.npmjs.com/~fox1t>
|
|
255
256
|
* [__Manuel Spigolon__](https://github.com/eomm), <https://twitter.com/manueomm>, <https://www.npmjs.com/~eomm>
|
|
256
257
|
* [__James Sumners__](https://github.com/jsumners), <https://twitter.com/jsumners79>, <https://www.npmjs.com/~jsumners>
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
<h1 align="center">Fastify</h1>
|
|
2
2
|
|
|
3
3
|
## Benchmarking
|
|
4
|
-
Benchmarking is important if you want to measure how a change can affect the
|
|
4
|
+
Benchmarking is important if you want to measure how a change can affect the
|
|
5
|
+
performance of your application. We provide a simple way to benchmark your
|
|
6
|
+
application from the point of view of a user and contributor. The setup allows
|
|
7
|
+
you to automate benchmarks in different branches and on different Node.js
|
|
8
|
+
versions.
|
|
5
9
|
|
|
6
10
|
The modules we will use:
|
|
7
|
-
- [Autocannon](https://github.com/mcollina/autocannon): A HTTP/1.1 benchmarking
|
|
8
|
-
|
|
9
|
-
- [
|
|
10
|
-
|
|
11
|
+
- [Autocannon](https://github.com/mcollina/autocannon): A HTTP/1.1 benchmarking
|
|
12
|
+
tool written in node.
|
|
13
|
+
- [Branch-comparer](https://github.com/StarpTech/branch-comparer): Checkout
|
|
14
|
+
multiple git branches, execute scripts and log the results.
|
|
15
|
+
- [Concurrently](https://github.com/kimmobrunfeldt/concurrently): Run commands
|
|
16
|
+
concurrently.
|
|
17
|
+
- [Npx](https://github.com/npm/npx): NPM package runner used to run scripts
|
|
18
|
+
against different Node.js Versions and to execute local binaries. Shipped with
|
|
19
|
+
npm@5.2.0.
|
|
11
20
|
|
|
12
21
|
## Simple
|
|
13
22
|
|