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
While the first parameter in static.LocalFile is obvious, the second one — dealing with directory index files — is not. Namely, it's not really obvious that false actually means "skip the index.html file on the root of this directory" (or something like that).
Please consider one of the following:
Add a little more documentation explaining what this parameter is for, and in which cases it's best to leave it on false;
Add two new constants, say, static.UseIndexHTML and static.SkipIndexHTML or something descriptive like that, which get set to true and false respectively (to avoid breaking earlier code).
(or consider both!)
It's far easier to understand what r.Use(static.Serve("/static"), static.LocalFile("/path/to/static/files", static.SkipIndexHTML)) means — especially when looking at code after several months or years without remembering what true and false do in this case :)
The text was updated successfully, but these errors were encountered:
While the first parameter in
static.LocalFile
is obvious, the second one — dealing with directory index files — is not. Namely, it's not really obvious thatfalse
actually means "skip the index.html file on the root of this directory" (or something like that).Please consider one of the following:
false
;static.UseIndexHTML
andstatic.SkipIndexHTML
or something descriptive like that, which get set totrue
andfalse
respectively (to avoid breaking earlier code).(or consider both!)
It's far easier to understand what
r.Use(static.Serve("/static"), static.LocalFile("/path/to/static/files", static.SkipIndexHTML))
means — especially when looking at code after several months or years without remembering whattrue
andfalse
do in this case :)The text was updated successfully, but these errors were encountered: