where do esp8266 library install arduino code example
Example: install nodemcu in arduino
Go to file -> preferances.
Add below link to additional board manager.
LINK: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Tools -> Boards Manager
Search for ESP and install esp8266