Output Response
The final step of our 8 step recipe is the output response. We will be following the guidelines suggested in chapter 3, Representational Design. As mentioned in a previous section of this chapter, we'll be using Data Transfer Objects in our application to help with following those guidelines.
Just in case you are not sure why we will be using DTOs for our output response, here are 3 main reasons for using them in our project.
The first is that we can use them for creating a global wrapper in our code, that way we can have a consistent format being spat out as the response.
The second is that it can transform the output of our response. This means adding in newer properties and in some cases taking away properties that we do not want to expose.
The third is that it creates a contract. It creates a contract that must be obeyed because it let's the client consuming it know what should be returned.
Last updated