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

switch to chi router in weather example #296

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

neha-viswanathan
Copy link
Contributor

As part of Goa v3.13.0, the default router was switched to chi (Ref: goadesign/goa#3346)
This PR updates the weather example to use chi.

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2023

Codecov Report

Merging #296 (8d33d2e) into main (c425dc9) will not change coverage.
The diff coverage is n/a.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##             main     #296   +/-   ##
=======================================
  Coverage   94.26%   94.26%           
=======================================
  Files          43       43           
  Lines        2338     2338           
=======================================
  Hits         2204     2204           
  Misses         98       98           
  Partials       36       36           
Flag Coverage Δ
micro 94.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@raphael raphael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This needs a tweak though.

@@ -73,7 +73,7 @@ func main() {
// 3. Setup metrics
ctx = metrics.Context(ctx, genfront.ServiceName,
metrics.WithRouteResolver(func(r *http.Request) string {
return httptreemux.ContextRoute(r.Context())
return chi.RouteContext(r.Context()).RoutePattern()
Copy link
Member

@raphael raphael Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually does not work in the general case: the chi context gets initialized after this runs. Instead the code needs to be mux.ResolvePattern(r): the Goa mux will initialize the chi route context if not initialized already.

@raphael
Copy link
Member

raphael commented Sep 29, 2023

Thank you!

@raphael raphael merged commit 1ed4f90 into goadesign:main Sep 29, 2023
1 check passed
@neha-viswanathan neha-viswanathan deleted the switch-to-chi branch December 4, 2023 05:32
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

Successfully merging this pull request may close these issues.

None yet

3 participants