In the previous chapter, we wrapped up the theory behind async and await. Let’s get back to the main Threadbear application, beginning with a reorganization of code!
In this chapter, we’re going to learn about controllers and middleware. These are two powerful concepts for organizing and reusing code. The first will help us to slim down our routes file, and the second will help us to add reusable things such as authentication and content-negotiation features.
Making Controllers
So far, we’ve been putting all of our request and response code into the ...