In the previous chapter, we learned about requests. The flip side of that coin is responses. For each request that demands something of our application, a well-crafted JSON, XML, or HTML response is the answer. Perhaps the request is for a list of users or an API authentication. In this chapter, let’s learn the ins and outs of responses.
Sending Simple Responses
We’ve already seen several ways to respond to HTTP requests. We started off by returning strings from our route closures. These strings were then rendered as HTML responses in the browser.
We reused this idea ...