A web application's backend will spend most of its time handling requests from the front end. The response to the request depends on what address we requested and what HTTP verb we used. Most often, developers use two verbs:
- POST request
- GET request
You can learn more about HTTP protocol verbs in the corresponding course. For now, we'll clarify that the verb is the same part of the query as the URL in the browser address bar.
Virtually any web application will need to:
- Accept the request
- Determine which handler we should execute
- Run the handler and prepare the response
- Return the response to the customer
This set of actions remains virtually unchanged from project to project, which is why it is in the framework. We will discuss how microframeworks work and where to use them.
What is a framework?
A typical framework works in the "Don't call us, we'll call you ourselves" mode:
- The framework user embeds their functions in the ready-made framework
- The framework decides when and which functions to call
It is the difference between a framework and a regular library — libraries usually give control to the user. Let's look at an example of code built using a web framework: