Fix the week_1 http server section
Opened this issue · 1 comments
barneymorris commented
At week_1/http/cmd/http_client/main.go
this line
getPostfix = "/notes/%d"
has to be
getPostfix = "/notes/{id}"
because otherwise each time you client call the server it always get 404.
From go-chi docs:
// Regexp url parameters:
r.Get("/{articleSlug:[a-z-]+}", getArticleBySlug) // GET /articles/home-is-toronto
DementevVV commented
const (
getPostfix = "/notes/%s" // Use a string parameter
)
r.Get(fmt.Sprintf(getPostfix, "{id}"), getNoteHandler)