adhocteam / pushup

Pushup is for making modern, page-oriented web apps in Go
https://pushup.adhoc.dev
MIT License
840 stars 30 forks source link

Trailing slash or no #31

Open paulsmith opened 1 year ago

paulsmith commented 1 year ago

30 brought up how handling a trailing slash should work. Should it be the default to have a trailing slash in URL paths, and redirect if a request would have matched but for the missing trailing slash, like for example how it works in Django? The current Pushup way is to match routes without a trailing slash, and then if one is present, redirect to one that would match with it removed.

Django way:

request /foo redirects to /foo/

(Current) Pushup way:

request /foo/ redirects to /foo

llimllib commented 1 year ago

There's of course a third way: /foo and /foo/ both serve indexes and do no redirection. That's the way ls works, which is pretty much the way I think of the path - as a file system path at a remote server

llimllib commented 1 year ago

Was this closed by 7334e58f148c4443888704daf19d7e7b4233267c?

paulsmith commented 1 year ago

It fixed the current problem of going to a route and getting a 404 because of a trailing slash, but the larger design decision isn't made. I think I'm leaning your 3rd way.