Lifecycle

Following the schema of the internal lifecycle of Fastify.On the right branch of every section there is the next phase of the lifecycle, on the left branch there is the corresponding error code that will be generated if the parent throws an error (note that all the errors are automatically handled by Fastify).

  1. Incoming Request
  2. └─▶ Routing
  3. └─▶ Instance Logger
  4. 404 ◀─┴─▶ onRequest Hook
  5. 4**/5** ◀─┴─▶ run Middlewares
  6. 4**/5** ◀─┴─▶ preParsing Hook
  7. 4**/5** ◀─┴─▶ Parsing
  8. 4**/5** ◀─┴─▶ preValidation Hook
  9. 415 ◀─┴─▶ Validation
  10. 400 ◀─┴─▶ preHandler Hook
  11. 4**/5** ◀─┴─▶ User Handler
  12. └─▶ Reply
  13. 4**/5** ◀─┴─▶ preSerialization Hook
  14. └─▶ onSend Hook
  15. 4**/5** ◀─┴─▶ Outgoing Response
  16. └─▶ onResponse Hook