In this section, we will refactor the application a bit so that, depending on the request headers, our application can respond in HTML, JSON or XML format.