During your work on the Book API in Chapter 5 it became evident that you need to start using a separate test database. You also don’t have very good error responses for API consumers yet. Responding to a client with an HTML error that expects JSON is not going to cut it anymore. When an API consumer interacts with your API, you want to respond with the correct Content-Type header. For now, you will assume all of your consumers want JSON, and in my experience, JSON is typically what consumers want.
Test Database
The main focus of this chapter will be error responses, but before you work on error responses ...