Nodemcu to nodemcu communication via wifi without router.

Hello , i am building a project for my home to control light from one nodemcu to another via built in esp8266 without router and without webpage . is that possible?
Can i get the code for the same for client and access point.

Just connect ESP #1 as a station to the access point of ESP #2.
Or you could use some kind of WiFi mesh.