Skip to content

Request Lifecycle

The request lifecycle is the process that a request goes through in order to be handled by the server. This process is the same for all requests, regardless of the type of request or the route that it is sent to.

The following image summarizes the request lifecycle in Serinus:

Request Lifecycle

The request lifecycle consists of the following steps:

  • Request: The client sends a request to the server.
  • onRequest: Serinus receives the request and execute all the onRequest hooks.
  • Routing: Serinus determines which route to use based on the request URL.
  • tranform: Serinus executes the local transform hook.
  • parse: Serinus executes the local parse hook.
  • Middlewares: Serinus executes the middlewares for the route.
  • beforeHandle: Serinus executes the global beforeHandle hook and then the local one.
  • Handler: Serinus executes the handler for the route.
  • afterHandle: Serinus executes the local afterHandle hook and then the global one.
  • onResponse: Serinus executes the onResponse hooks.
  • Response: Serinus sends the response back to the client.

Built with 💙 and Dart 🎯 | One of the 🐤 of Serinus Nest