Request Lifecycle
Requests in the Angel3 framework go through a relatively complex lifecycle, and to truly master the framework, one must understand that lifecycle.
startServeris called.Each
HttpRequestis sent throughhandleRequest.handleRequestconverts theHttpRequestto aRequestContext, and converts itsHttpResponseinto aResponseContext.angel3_routeis used to match the request path to a list of request handlers.Each handler is executed. Each handler must return
truefor the next one to run.If the response is streamed (the default), rather than buffered (
res.useBuffer()), skip to step 9.All
responseFinalizersare run.All headers, the status code and the response buffer are sent through the actual
HttpResponse, with aContent-Lengthheader, unlessres.chunkedistrue.The
HttpResponseis closed.
When the server shuts down, AngelHttp.close() stops accepting requests, lets those in progress finish, within closeTimeout, and then runs the app's shutdownHooks.
If at any point an error occurs, Angel3 will catch it. See the error handling docs for more.
Next Up
Continue reading to learn about Dependency Injection.
Last updated
Was this helpful?