Here I'll show you how to program small ESP8266EX and fix cheap relay module.
If you just bought ESP8266 or NodeMCU and don't know what to do next, visit my Starting With NodeMCU - Blinking LED project.
I also recommend to watch video bellow about this project, I think it will be easier for you to follow.