Chapter 3.
Configuration and error handling
In this section of the book we’re going to do some housekeeping. We won’t add much new functionality to our application, but instead focus on improvements that will make it easier to develop and manage.
You’ll learn how to:
- Pass configuration settings for your application at runtime in an easy and idiomatic way using command-line flags.
- Create a custom logger for writing structured and levelled log entries, and use it throughout your application.
- Make dependencies available to your handlers in a way that’s extensible, type-safe, and doesn’t get in the way when it comes to writing tests.
- Centralize error handling so that you don’t need to repeat yourself when writing code.