For this example project I have used only 2 relay circuit, but the actual program wrote for connecting four relay module.
You can check the above video on how this thing works and how to connect your browser to the ip address returned from esp and all the details are included in this video.
Copy the below arduino code and paste into your Arduino IDE and upload the program to your nodemcu or any other esp devices that you are using, make sure to choose the correct port and device name from the board. also don't forget to change the SSID and password to your Wi-fi settings.
This program for the esp8266 wrote to return the status of the device , which will in turn notify us with the device state in the browser which will also make the user to know which device has currently turned on or off.
Copy the above code and complete the process. Share and let others know about this tiny chip which can do dozens of magic.