@fastify/express 2.0.1 → 2.0.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/.github/workflows/nodejs.yml +2 -4
- package/README.md +7 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ async function build () {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
build()
|
|
43
|
-
.then(fastify => fastify.listen(3000))
|
|
43
|
+
.then(fastify => fastify.listen({ port: 3000 }))
|
|
44
44
|
.catch(console.log)
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -92,7 +92,7 @@ fastify.register(require('@fastify/express'))
|
|
|
92
92
|
fastify.use(router)
|
|
93
93
|
})
|
|
94
94
|
|
|
95
|
-
fastify.listen(3000, console.log)
|
|
95
|
+
fastify.listen({ port: 3000 }, console.log)
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
#### Testing Your App
|
|
@@ -221,7 +221,7 @@ Example application:
|
|
|
221
221
|
```js
|
|
222
222
|
const Fastify = require('fastify')
|
|
223
223
|
const Express = require('express')
|
|
224
|
-
const expressPlugin = require('fastify
|
|
224
|
+
const expressPlugin = require('@fastify/express')
|
|
225
225
|
const bodyParser = require('body-parser')
|
|
226
226
|
|
|
227
227
|
const fastify = Fastify()
|
|
@@ -239,21 +239,21 @@ fastify.post('/hello', (req, reply) => {
|
|
|
239
239
|
})
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
For this case, you need to remove `body-parser`, install
|
|
242
|
+
For this case, you need to remove `body-parser`, install `@fastify/formbody` and change `@fastify/express` options:
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
```js
|
|
246
246
|
const Fastify = require('fastify')
|
|
247
247
|
const Express = require('express')
|
|
248
|
-
const expressPlugin = require('fastify
|
|
249
|
-
const fastifyFormBody = require('fastify
|
|
248
|
+
const expressPlugin = require('@fastify/express')
|
|
249
|
+
const fastifyFormBody = require('@fastify/formbody')
|
|
250
250
|
|
|
251
251
|
const fastify = Fastify()
|
|
252
252
|
const express = Express()
|
|
253
253
|
|
|
254
254
|
await fastify.register(fastifyFormBody)
|
|
255
255
|
await fastify.register(expressPlugin, {
|
|
256
|
-
// run express after
|
|
256
|
+
// run express after `@fastify/formbody` logic
|
|
257
257
|
expressHook: 'preHandler'
|
|
258
258
|
})
|
|
259
259
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastify/express",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Express compatibility layer for Fastify",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"simple-get": "^4.0.0",
|
|
39
39
|
"standard": "^17.0.0",
|
|
40
40
|
"tap": "^16.0.0",
|
|
41
|
-
"tsd": "^0.
|
|
41
|
+
"tsd": "^0.22.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"express": "^4.17.1",
|
|
45
|
-
"fastify-plugin": "^
|
|
45
|
+
"fastify-plugin": "^4.0.0"
|
|
46
46
|
},
|
|
47
47
|
"tsd": {
|
|
48
48
|
"directory": "test/types"
|