This pull request adds the option FS to the ServerOptions of the file server middleware which allows passing an fs.FS as content root.
For example, this makes it possible to use static web files directly compiled into the binary using embed.FS.
When the FS field is specified, this overrides the set RootPath. Otherwise, when FS is not specified, the given (or default) RootPath is used via os.DirFS.
Additionally, I've added a .gitattribute which specifies the contents of file/testdata to be cloned with LF end of lines. Otherwise, all unit tests fail when cloned on a Windows system because files are converted to CLRF.
This pull request adds the option
FS
to theServerOptions
of the file server middleware which allows passing anfs.FS
as content root.For example, this makes it possible to use static web files directly compiled into the binary using
embed.FS
.When the
FS
field is specified, this overrides the setRootPath
. Otherwise, whenFS
is not specified, the given (or default)RootPath
is used viaos.DirFS
.Additionally, I've added a
.gitattribute
which specifies the contents offile/testdata
to be cloned with LF end of lines. Otherwise, all unit tests fail when cloned on a Windows system because files are converted to CLRF.