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

ServeFiles not able to serve static files #337

Open
ta1bbty opened this issue Aug 30, 2021 · 2 comments
Open

ServeFiles not able to serve static files #337

ta1bbty opened this issue Aug 30, 2021 · 2 comments

Comments

@ta1bbty
Copy link

ta1bbty commented Aug 30, 2021

Hi @julienschmidt

Thanks for the awesome library.

I am trying to host static files along with the API .

This is how I am doing this.

r.HandlerFunc("GET", "/:username", handler.Get)
r.HandlerFunc("GET", "/:username/:todo", handler.Todo)

r.ServeFiles("/login/*filepath", http.Dir("templates"))

I get the error :
panic: 'login' in new path '/login/*filepath' conflicts with existing wildcard ':username' in existing prefix '/:username'

On searching through the issues, I found this #183

Is it due to this 🤔

Thanks.

@go-aegian
Copy link

I did review your question and while waiting on my branch to see if it apt for merging to here. You can check out this branch with your problem. What I suggested in the example is if you can prepend the handlers with "user/:username" & "/user/:username/:todo" as shown in the example files here

https://github.com/sainzg/httprouter/commit/c0fbccf698543dc30d3bc0eb2007d436394a5459

@dolmen
Copy link

dolmen commented Apr 26, 2022

Please rename this issue because it seems it is not specific to ServeFiles, but more to a path conflict.

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

No branches or pull requests

3 participants