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

Default route does not work. #8

Open
natschz opened this issue Dec 22, 2021 · 0 comments
Open

Default route does not work. #8

natschz opened this issue Dec 22, 2021 · 0 comments

Comments

@natschz
Copy link

natschz commented Dec 22, 2021

I created a hostrouter like in the readme.

	r := chi.NewRouter()
	r.Get("/test", func(writer http.ResponseWriter, request *http.Request) {
          //...
	})

	hr := hostrouter.New()
	hr.Map("", r) // default

But always got 404s. Changed it to wildcard (hr.Map("*", r) ) and it worked. This took my quite some time to figure out, don't know if I'm missing something or not. But after inspecting the hostrouter .ServerHttp function, I suspect that is no "default" at all?

Maybe hr.Map("", apiRouter()) // default should be removed from the readme, or if I'm missing something then maybe update the readme to make it clearer?

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

1 participant