Web-Server

Web server for NodeMCU firmware.

Features

  • GET, POST requests
  • Parser forms (application / x-www-form-urlencoded and application / json)
  • Ability to download additional. files (js, css, ico, txt, jpg).
  • Minimum code size in memory, in standby mode.
  • Ability to include LUA code in the HTML page. <?lua return(node.chipid()) ?>
  • Run LUA scripts and send them parameters using POST and GET requests.
  • Minimal authentication.
  • Ability to download compressed files (.gz).
  • Updating files from the cloud

Structure

  • Initialization:
  • init.lua - initialization of settings and wi-fi.
  • init_settings.lua - getting settings, as well as keeping the default settings.
  • init_wifi.lua - connection to the wifi network.
  • Main scripts:
  • web.lua - is the web server itself.
  • web_request.lua - parsing data from the client.
  • web_get.lua - requests and download files from the network
  • web_file.lua - transfer files, run scripts and load html pages with lua code.
  • web_control.lua - authentication, saving parameters, obtaining a list of access points.
  • Files:
  • favicon.ico - icon.
  • index.html - home page.
  • settings.html - settings page.
  • service.html - service page.
  • login.html - page authentication.
  • script_settings.js.gz - js script (compressed) for processing and sending forms.
  • style.css.gz - style file (compressed).

Installation

  1. Required modules (crypto, file, gpio, net, node, sjson, tmr, uart, wifi). Building the firmware
  2. Download all files to esp8266.
  3. Connect to the access point Web server and go to the address 192.168.4.1.