@@ -45,10 +45,12 @@ In addition, the response headers will contain all headers defined in `error.hea
4545To clarify, take this server as a example:
4646
4747``` 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'
5051
51- server .register (require (' fastify-http-errors-enhanced' ))
52+ const server = fastify ()
53+ server .register (FastifyHttpErrorsEnhanced)
5254
5355server .get (' /invalid' , {
5456 handler : async function (request , reply ) {
@@ -101,10 +103,12 @@ If not hidden, instead, the error will be returned in a standard response that a
101103To clarify, take this server as a example:
102104
103105``` 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'
106110
107- server .register (require ( ' fastify-http-errors-enhanced ' ) , { hideUnhandledErrors: false })
111+ server .register (FastifyHttpErrorsEnhanced , { hideUnhandledErrors: false })
108112
109113server .get (' /invalid' , {
110114 handler (request , reply ) {
0 commit comments