When using any tool in the "real world", you feel more confident if you understand how that tool works. Application development is no different. When you understand how your development tools function, you feel more comfortable and confident using them.
The following steps describe a basic API call scenario:
- The User calls an
Middlewareto handle the Authentication.
Endpointcalls its corresponding
Requestobject, which is injected in the
Controller, applies the request validation and authorization rules.
Actionand passes the data from the
Requestobject to it.
Actionexecutes the business logic or call as many
Tasksexecute reusable subsets of the business logic.
Actionprepares the data to be returned to the
Controller, and may collect data from the
Controllerbuilds the response using a
Transformer, and sends it back to the User.
It is important to note that the
Request object handles request validation and authorization rules,
Action executes the business logic.
Tasks can be used to execute reusable subsets of the business logic,
Task responsible for a single portion of the main
Transformer is used to build the response that is sent back to the User.
Request Lifecycle Diagram
- Solid Line: Mandatory dependency (always used)
- Doted Line: Optional dependency (not always used)
- Red Solid Border: Response generation
- Green Dashed Border: Optional component (not always used)