Guides  ›  References  ›  Hook order ← PREV NEXT →

Hook order

Step Hook or operation
1 Create state, run app begin
2 Check request, find route or static file, parse POST body
3 App before → route before
4 Middleware → schema → handler
5 Route after → app after
6 Send response
7 Set end and ms; log in development
8 Route done → app done

A non-undefined result stops steps 3–4. A value from begin skips steps 2–4. After hooks replace the response by assigning state.result.

On an exception, route error then app error run before sending; done still runs. Static serving sends its own response during step 2. done callbacks are not awaited.

Next: JSON Response →

Tools for business systems.