I've written a couple intro tutorials in french (Les Bases d'un Serveur Web sur ESP-01 en commande AT and Techniques "avancées" de serveur web sur ESP8266). May be google translate can help you read those.
I think there are important things to understand before diving into a web code though:
If I want to be simplistic, the way it works could be described as follow:
The client (basically a web browser) opens a connexion to the server and sends a request using the HTTP protocol (basically you type a URL to get things started)
the client interprets the document description and paints the screen / acts accordingly
At that stage the connexion is usually closed. The request has been handled. There is no more link between the client and the server.
Going back to the server means you do that cycle again: the client contacts the server over HTTP and requests a new document.
Where the magic happens is that:
In the page description language you have specific capabilities (basically forms with textfield, checkbox, buttons, ...) to describe an interactive User Interface and what happens if the user on the client triggers an action (basically this is a request for a new document from the server and some data from the web browser will be sent to the server).
the HTTP protocol describes various Request Methods and the two most common are GET and POST. In particular they describe how the data (status of your check box, content of a textfield, ...) is encoded within the Request Method.
The server recognizes the Request Method being used, decodes the parameters and takes action to build a new document that is sent back to the client
the connexion is closed and the cycle can start over again.
There is one more thing:
- The programming language can affect how things are painted over the screen
- One specific possibility is also to trigger an HTTP request and get an answer: a frequently used technic is called AJAX. With AJAX you can read data from a web server after the page has loaded, you can update a web page without reloading the page and you can send data to a web server - in the background.
Libraries such as ESPAsyncWebServer makes it easy to set up a server ready to handle any form of Request Methods. The library will help you unpack the parameters and provide various ways of sending the document answer back to the client (dealing with the necessary protocol information so that you can only focus on the description).
➜ It depends on the learner how they want to achieve this.
If I had to learn now, that's how I would do it, it suits my learning style (may be not suited for everyone) as
I learn better by understanding all the building blocks and concepts, independently of of each others and then putting things together.
You have tons of training material available on line and you can go as deep as you want on each.
1/ Read a bit about HTTP and play with your ESP to set up a basic server listening on port 80 and see what you get when you type an URL in your favorite web browser
2/ Read a bit about HTML and generate a simple page that you send back to the client. As everything is text, you can play around in your ESP code to dynamically generate HTML (eg send the value you read on A0 for example).
4/ Then keep exploring HTML and forms. Build a page with a form and a submit button and see what you get on your ESP when you click submit.
6/ Then Explore AJAX and start playing with it still with your ultra simple ESP listening on port 80.
At that stage you start understanding that extracting information from the request is really about text parsing. Having a good grasp on cStrings functions helps or you can use the String class.
If you got that far, you have accumulated enough experience and understanding on the pieces of the puzzle and that's where Libraries such as ESPAsyncWebServer can come into play to avoid re-inventing the wheel.
Libraries are specific and then you can read tutorials and examples from those libraries. But as you are now equipped with the concepts, you know what's going on in the background and there is no black magic.
My strong belief is that if you lack the foundations, you are building on sand and moving grounds and can't really do something great, you'll be trying all sorts of things and workaround because you don't get what's happening behind the scene. (you can always try to work your way up from sample code but I don't find this satisfying).