Chapter 7. Playing with Globals
Sometimes web applications require application-wide objects that live beyond the request-response life cycle, such as database connections, application configuration, shared objects, and cross-cutting concerns (authentication, error handling, and so on). Consider the following:
- Ensuring that the database used by the application is defined and accessible.
- Notify through e-mail or any other service when the application is receiving unexpected heavy traffic.
- Logging the different requests served by the application. These logs can later be used to analyze user behavior.
- Restricting certain facilities on the web application by time. For example, some food ordering apps take orders only between 11 a.m. to 8 p.m., while all ...