Open bmedici opened 1 year ago
Something like this would be great. I went down the SPIFFS route as well at first - nice and easy for development, but doesn't work well for doing OTA updates. Having it all in one single binary is definitely the way to go.
Any plan to implement this within the webserver maybe ? @me-no-dev
The most used case is of course, to serve static files from a SPIFFS filesystem. This is great and works fine, for example with
In my case, I need to embed all the served files into the firmware. Many reasons for these reasons
This build phase already builds a .h file containing PROGMEM declarations for theses files :
These are compiled along with the code and can be accessed by the webserver as-is.
I wish we could have something like SPIFFS interface to serve these assets from an index, for example a std::unordered_map with the file path as the key, and file contents (or pointer to data array) as the value. Having the webserver handle the "not found" situation. Plus, I have use a regex path to get the path and serve the content, which is less than optimal.
Something like
could be great, and we could implement simple functions for a lookup in the map, to provide the right content-type and of course, the content pointer to return.
The implementation could automatically handle the file compression (or de-compression) as it works today for SPIFFS files. As long as we provide gzipped-bytes-array as the data and tell the webserver the content is gzipped.
Any thoughts about this ?
Thanks for this great projet, and for your suggestions.