GitHub is a great place for anyone doing software development. If there is anything you are trying to do that anyone else might have thought about doing at some point in the past, it probably exists on GitHub.
I needed to create a wireless access point with an ESP and display a webpage to enter connection details. That sounded hard, so I searched GitHub and found this handy project: WiFi Manager by Tzapu. It is available under the MIT licence (my second favourite after Beerware).
It handles setting up an access point, either open, a name and password of your choice or using the chip name and ID. You then navigate to its default IP address (192.168.1.4), select an SSID, enter the password and you’re away. It will save the details to EPROM and auto-connect or reset to its access point if it fails to connect. You can also add custom settings other than SSID and password, such as a server address and access Key.
I created a new example which is already setup to create two extra information boxes, for a server address (ThingSpeak) and a key. The example is configured to work with ThingSpeak and sends an iterated number every 20s. It can be run as is to connect to your WiFi and post to your ThingSpeak account, all from the sign-in webpage. It should be simple to add a function to read from a sensor and send that data instead. It also has a function to reset and clear the device by taking pin 13 (D7 on a Node MCU) low. This will wipe the WiFi settings, JSON EPROM file and restart the device in AP mode.
Currently my WiFi Manager example is currently only on my GitHub fork, but I have a pull request waiting. An example of the login page is shown below.
I expect this library will feature in future projects, if I ever finish them.