Skip to content

Commit 77eb239

Browse files
committed
chore: Updated README
1 parent 5a32814 commit 77eb239

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ In addition, the response headers will contain all headers defined in `error.hea
4545
To 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

5355
server.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
101103
To 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

109113
server.get('/invalid', {
110114
handler(request, reply) {

0 commit comments

Comments
 (0)