My SPIFFS filesystem contains index.html and webpage.html. From a browser, I can go to "http://esp" and get the base index.html. I can go to "http://esp/demo" and get demo.html. But if I go to "http://esp/webpage", it doesn't load webpage.html. I have a catch-all error handler that gives me "not found". I have to specify webpage.html to get it to load.
I understand that I can either rename all my *.html files as * (no .html extension) but then they are ambiguous and won't trigger html editor extensions. I can also create a handler for every file.html that I add to SPIFFS, but that's going to be error prone and tedious. I would like file.html to simply be served as a static file, which is what I thought serveStatic() would do.
Given that normal web resources have an extension, you could try using the regex functionality: if there's no dot, try .html. Something like (untested)
What happens if you send(SPIFFS a file that doesn't exist? Maybe you don't need to test yourself.
I'd argue that if /demo is a directory/folder, the web server should return a redirect to /demo/, and then the URL-path /demo/ should return the content of /demo/index.html and/or perhaps /demo/demo.html. If you have a bunch of index.html you have to look at the path to distinguish them; if what is immediately visible are the tabs in an editor for example, having unique names helps. Any distinct supporting files are more likely to named demo.js or demo.css, not index.
No slash at the end -- check before clicking -- but when you do, your address bar will end up at /v20.14.0/ with the slash at the end. Poke around a little, and you will see the redirect. A 301 Moved Permanently. BTW, same with