Crissium / SilverDict

Web-Based Alternative to GoldenDict
https://silverdict.lecoteauverdoyant.co.uk
GNU General Public License v3.0
162 stars 18 forks source link

Handle client side routing. #17

Open Crissium opened 1 month ago

Crissium commented 1 month ago

Tried a wildcard path and it didn't work.

simonmysun commented 1 month ago

Maybe consider switch to createHashRouter?

Crissium commented 1 month ago

Maybe consider switch to createHashRouter?

Thanks for your advice but I was talking about the following problem: if you manually enter the address http://127.0.0.1:2628/library/dictionaries, Flask would return 404 because there isn't a corresponding route registered. At this point it should return index.html instead. That is, I am trying to achieve the equivalent to this nginx config: try_files $uri $uri/ /index.html; with Flask.

Well I should have been clearer when I create an issue, even if it's in my own repo...

simonmysun commented 1 month ago

I hope I haven't misunderstood you. In this case, you could either switch to HashRouter so that the path would be http://127.0.0.1:2628/#/library/dictionaries and flask won't complain anythng, or you could configure a fallback catch-all router for flask and route everything it doesn't know to react and let it handle, or like you said, use nginx to redirect the paths.

Crissium commented 1 month ago

Sorry I misunderstood your comment at first because I'm not familiar with the term hash router and read it as something wildly different 😅. Indeed it should be a very good solution to try out