Default route does not work.
- Dominant language
- Go
- Stars
- 80
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
I created a hostrouter like in the readme.
```go
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the default-host example in the README and inspect the hostrouter ServerHttp function to compare empty-host and wildcard mappings. Reproduce the 404 using the provided chi router, then confirm whether the behavior or only the documentation needs changing; done means the default mapping works as documented or the README clearly explains the required wildcard.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100