Welcome to the Linux Foundation Forum!
05. CREATING RESTFUL JSON SERVICES - NotFound() function problem

Title: Implementing a RESTful JSON GET with Fastify (Cont.)
Note:
Line: if (err.message === 'not found') reply.notFound()
when I test a not found page fastify show this error:
TypeError: reply.notFound is not a function
[fastify-cli] app crashed - waiting for file changes before starting…
So I check de Fastify documentation and I found that using callNotFound() it would work. So I change the code to
if (err.message === 'not found') reply.callNotFound()
- Be careful with the next exercise, it has a similar behavior
0
Comments
Have you tried registering the fastify-sensible plugin?
fastify.register(require('fastify-sensible'))
It worked for me with that, but the instruction to register the plugin is missing in the course (maybe that's premeditated?)
hey @ariel15584 and @canelacho thanks both for the feedback on this - @ariel15584 is correct that it needs to be registered by this is accidental omission not premeditation. The following that section has been updated to specify registering fastify-sensible
As for reply.callNotFound, fastify-sensible is more recommended for the following reasons: