Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make file server with options #18

Merged
merged 6 commits into from
Aug 22, 2021
Merged

make file server with options #18

merged 6 commits into from
Aug 22, 2021

Conversation

umputun
Copy link
Member

@umputun umputun commented Aug 22, 2021

The current way to make FileServer is a little bit awkward with an optional reader for 404 (can be nil) and the second FileServerSPA where the reader passed too. It also doesn't allow to turn directory listing on as we suppress it.

This PR adds func options for the NewFileServer constructor with several options:

  • FsOptSPA - turns SPA mode on
  • FsOptListing - turns directroy listing on
  • FsOptCustom404 - sets custom not-found page reader

Both existing methods (FileServer and FileServerSPA) are still supported for back compatibilty

@coveralls
Copy link

coveralls commented Aug 22, 2021

Pull Request Test Coverage Report for Build 1156494862

  • 56 of 60 (93.33%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.1%) to 85.14%

Changes Missing Coverage Covered Lines Changed/Added Lines %
file_server.go 56 60 93.33%
Totals Coverage Status
Change from base Build 1040824473: 1.1%
Covered Lines: 487
Relevant Lines: 572

💛 - Coveralls

@umputun umputun merged commit 51f9235 into master Aug 22, 2021
@umputun umputun deleted the fs-opts branch August 22, 2021 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants