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

Static FileServer #36

Merged
merged 3 commits into from
Apr 1, 2016
Merged

Static FileServer #36

merged 3 commits into from
Apr 1, 2016

Conversation

lxfontes
Copy link
Contributor

@lxfontes lxfontes commented Apr 1, 2016

discussion #35

Usage

mux.FileServer("/css", http.Dir("./static/css"))
mux.FileServer("/", http.Dir("./static"))

Unfortunately it won't respect chi's NotFoundHandler

@pkieltyka
Copy link
Member

thanks @lxfontes for this! I'm going to merge and make a small addition.. that is to remove the _static folder and just use a in-memory http.FileSystem fixture in the mux_test

@pkieltyka pkieltyka merged commit 23a25f3 into go-chi:master Apr 1, 2016
@ufoscout
Copy link

ufoscout commented Jul 1, 2018

Was this feature removed in last release (i.e. 3.3.2)?
I am asking this because I have compilation errors when I use it:

import (
	...
	"github.com/go-chi/chi"
)
...
func Start() {
	chi.NewRouter().FileServer("/static", http.Dir("frontend"))
}

compilation error:

src/core/coreModule.go:56:18: chi.NewRouter().FileServer undefined (type *chi.Mux has no field or method FileServer)

Am I doing something wrong?
I see that this is deprecated in 3.0 changelog, it is completely removed now?

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.

3 participants