Skip to content

Default route does not work. #8

@natschz

Description

@natschz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions