You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to achieve the following using server.serveStatic()?
request path -> points to file
/ -> /index.html
/index.html -> /index.html (or redirects to /)
/about -> /about/index.html
/about/ -> /about/index.html (or redirects to /about)
/about/index.html -> /about/index.html (or redirects to /about)
/another-page -> /another-page.html
/another-page/ -> /another-page.html (or redirects to /another-path)
/not-matching-path -> /404.html or /404/index.html (one of matched with 404 status and no caching)
I have implemeted it with all assets embedded in c++ codes itself. Now, I wish to use filesystem to achieve the same so I thought server.serveStatic() should work but it lacks options or fallbacks options.
I have tried:
server.serveStatic("/", LittleFS, "/www/").setDefaultFile("index.html"); // probably for SPA apps, no 404 page handling options// what if following or similar options?// .setDirectoryFile("index.html")// .setNotFoundFile("404.html");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using a multi page framework which generates assets with following structure (which is copied to
data/www
):Is there any way to achieve the following using server.serveStatic()?
I have implemeted it with all assets embedded in c++ codes itself. Now, I wish to use filesystem to achieve the same so I thought server.serveStatic() should work but it lacks options or fallbacks options.
I have tried:
Here is my sample code I use for embedded assets:
www.h
main.cpp
Beta Was this translation helpful? Give feedback.
All reactions