esp_http_server to serve files from spiffs

henk-iot
Posts: 2
Joined: Sun Dec 02, 2018 11:11 pm

esp_http_server to serve files from spiffs

Postby henk-iot » Sun Dec 02, 2018 11:22 pm

Im looking to see if it is possible to use the new esp_http_server.
The usecase is to serve files from spiffs, so you can start creating a website.

Current architecture of this server requires me to register a handler for every URI.
I might be overlooking something here, Is there any way to do this usecase of serving files?

A solution could be to allow matching uri-handlers to have a wildcard, and not only a full string match. E.G:
I want to have an uri handler for /spiffs/* so it would respond also to /spiffs/whateverfilename
The handler would then open the file, look at the extention for content-type and serve it.

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: esp_http_server to serve files from spiffs

Postby brp80000 » Tue Dec 04, 2018 12:03 pm

https://github.com/nkolban/ESP32_Explorer

files are stored in the spifs section and are given to the browser on request

ESP_Anurag
Posts: 19
Joined: Fri Aug 31, 2018 5:37 am

Re: esp_http_server to serve files from spiffs

Postby ESP_Anurag » Mon Feb 18, 2019 5:23 am

It may be too late for an answer, but URI wildcard matching scheme was recently added to esp_http_server. See the file server example offered by esp_http_server https://github.com/espressif/esp-idf/tr ... le_serving. This demonstrates serving files kept on SPIFFS storage

Who is online

Users browsing this forum: No registered users and 318 guests