Home / Function/ notFound() — fastify Function Reference

notFound() — fastify Function Reference

Architecture documentation for the notFound() function in reply.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  5ebe00b9_f378_7908_1ade_5e7acbd75a54["notFound()"]
  4bcd71dc_1ec2_5fe8_b8ff_4a371e392925["reply.js"]
  5ebe00b9_f378_7908_1ade_5e7acbd75a54 -->|defined in| 4bcd71dc_1ec2_5fe8_b8ff_4a371e392925
  7cbd49a5_6e8b_7418_297d_906965b38d38["callNotFound()"]
  7cbd49a5_6e8b_7418_297d_906965b38d38 -->|calls| 5ebe00b9_f378_7908_1ade_5e7acbd75a54
  193bf1cb_b908_f458_21f8_567503b5bf8f["code()"]
  5ebe00b9_f378_7908_1ade_5e7acbd75a54 -->|calls| 193bf1cb_b908_f458_21f8_567503b5bf8f
  86dc4e98_212d_2b7c_7128_76f05e7a8787["send()"]
  5ebe00b9_f378_7908_1ade_5e7acbd75a54 -->|calls| 86dc4e98_212d_2b7c_7128_76f05e7a8787
  style 5ebe00b9_f378_7908_1ade_5e7acbd75a54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/reply.js lines 963–983

function notFound (reply) {
  if (reply[kRouteContext][kFourOhFourContext] === null) {
    reply.log.warn('Trying to send a NotFound error inside a 404 handler. Sending basic 404 response.')
    reply.code(404).send('404 Not Found')
    return
  }

  reply.request[kRouteContext] = reply[kRouteContext][kFourOhFourContext]

  // preHandler hook
  if (reply[kRouteContext].preHandler !== null) {
    preHandlerHookRunner(
      reply[kRouteContext].preHandler,
      reply.request,
      reply,
      internals.preHandlerCallback
    )
  } else {
    internals.preHandlerCallback(null, reply.request, reply)
  }
}

Domain

Subdomains

Defined In

Calls

Called By

Frequently Asked Questions

What does notFound() do?
notFound() is a function in the fastify codebase, defined in lib/reply.js.
Where is notFound() defined?
notFound() is defined in lib/reply.js at line 963.
What does notFound() call?
notFound() calls 2 function(s): code, send.
What calls notFound()?
notFound() is called by 1 function(s): callNotFound.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free