@@ -45,10 +45,12 @@ In addition, the response headers will contain all headers defined in `error.hea
45
45
To clarify, take this server as a example:
46
46
47
47
``` js
48
- const server = require (' fastify' )()
49
- const { NotFoundError } = require (' http-errors-enhanced' )
48
+ import fastify from ' fastify'
49
+ import FastifyHttpErrorsEnhanced from ' fastify-http-errors-enhanced'
50
+ import { NotFoundError } from ' http-errors-enhanced'
50
51
51
- server .register (require (' fastify-http-errors-enhanced' ))
52
+ const server = fastify ()
53
+ server .register (FastifyHttpErrorsEnhanced)
52
54
53
55
server .get (' /invalid' , {
54
56
handler : async function (request , reply ) {
@@ -101,10 +103,12 @@ If not hidden, instead, the error will be returned in a standard response that a
101
103
To clarify, take this server as a example:
102
104
103
105
``` js
104
- const server = require (' fastify' )()
105
- const createError = require (' http-errors' )
106
+ import fastify from ' fastify'
107
+ import FastifyHttpErrorsEnhanced from ' fastify-http-errors-enhanced'
108
+ import { NotFoundError } from ' http-errors-enhanced'
109
+ import createError from ' http-errors'
106
110
107
- server .register (require ( ' fastify-http-errors-enhanced ' ) , { hideUnhandledErrors: false })
111
+ server .register (FastifyHttpErrorsEnhanced , { hideUnhandledErrors: false })
108
112
109
113
server .get (' /invalid' , {
110
114
handler (request , reply ) {
0 commit comments