Simple standalone http server made with esp8266 and nodemcu

The following code is a standalone http server made with esp8266 and nodemcu written in lua.
The esp8266 is in wifi.SOFTAP mode (SoftAP is an abbreviated term for “software enabled access point.” This is software enabling a computer which hasn’t been specifically made to be a router into a wireless access point. It is often used interchangeably with the term “virtual router”.)

You can connect connect your smarthone with the esp8266 direct without any router or other network infrasructure. Just load the following code as init.lua on you eso8266 flash ram and reset.

The following circuit shows the min. configuration for your esp8266 to get the best stability.
ESP8266_improved_stability

If you ues a board with GPIO16 (Not ESP-01) you can connect the GPIO16 with REST to use the dsleep function. Otherwise your esp8266 will not wake up after execution of dsleep.

Connect the esp8266 to the wireless network

For the IoT you can use a cheap esp8266 microcontroller with WiFi onboard. To connect the esp8266 to the wireless network you can use the following lua snippet that will work with the nodemcu firmware.

After connecting to the internet, you can create a TCP/IP server or client to send and receive data from your esp8266 microcontroller.