To be useful in a variety of projects it was decided that esp_httpd should be able to:
- Serve files stored in flash using SPIFFS. These files will be static HTML, CSS, JS and images that comprise the host device's web interface.
- Differentiate between GET, POST, PUT, and DELETE requests. This is how the host device will correctly respond to AJAX requests.
- Parse key-value pairs in the URI or body. Data to be parsed can be submitted in the URI as a typical GET query string, or as key-value pairs in the body as in a typical POST. The data parsing should not be automatic in case raw or JSON-encoded data is sent in the body.
- Route to different handlers based on the URI furnished, with support for a trailing wildcard and cascading handlers.
- Use C-strings exclusively in place of Arduino String objects in an effort to minimize the potential for heap fragmentation.
The aspect of libesphttpd that really caught my attention was the routing array. I appreciate how the array codifies URI's to which the server is prepared to respond. Because esp_httpd is intended to be used in a RESTful manner it expands the routes specification to include the required method, if any.
esp_httpd is very much a work in progress - my first GitHub submitted projects. Your feedback is welcome and greatly appreciated.
https://github.com/gregschumacher/esp_httpd