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

Is Giraffe.EndpointRouting considered best practice? #534

Closed
SIRHAMY opened this issue Jan 8, 2023 · 3 comments · Fixed by #556
Closed

Is Giraffe.EndpointRouting considered best practice? #534

SIRHAMY opened this issue Jan 8, 2023 · 3 comments · Fixed by #556

Comments

@SIRHAMY
Copy link
Contributor

SIRHAMY commented Jan 8, 2023

Giraffe currently supports a few router types like:

  • Default router - what most of the docs talk about
  • Endpoint Routing - a subset of routing functionality that integrates with ASP.NET Core Routing (see: Endpoint Routing)
  • Token Router - Another alt (see: Token Router)

There may be more but these are the ones I see prevalent in docs / online.

  • Q1: Do we have a preferred routing choice? A "recommended" path?
  • Q2: If so, can we make that a bit more clear in the docs by making that choice more prevalent?

I am particularly curious about the direction the framework is going in terms of routing as I have little context on this.

Why do I care / why am I asking?

Problem: Confusion among new-comers for getting setup "right"

"Right" / "Best Practice" is always debatable but typically I see providing a sane default / recommendation as helpful for adoption.

Routing Best Practice

Based on my current knowledge / research it seems that Endpoint Routing is the future of Giraffe. Saturn seems to agree

Based on tradeoffs I think this seems reasonable:

Pros

Cons

  • Not all Giraffe routing functions are supported -> but a critical mass to do most everything you need
  • Requires a flat list of endpoints -> but may make some things simpler (though some previous patterns are broken based on open Issues like Authentication)
  • All endpoints are case insensitive -> debatable whether this matters

Next Steps

Curious if people have thoughts on this / think this matters.

In particular, some perspectives I think of that could be valuable:

  • Giraffe maintainers
  • Saturn maintainers
  • Experienced Giraffe users
  • New Giraffe users
@64J0
Copy link
Member

64J0 commented Aug 25, 2023

Good question! I would like to know as well.

@dustinmoris
Copy link
Member

Yes, the Endpoint Routing approach is the recommended way. All routing in ASP.NET Core was migrated to comply with the Endpoint Routing API I believe so it makes only sense for Giraffe to also follow this path as it will naturally have a higher ability to interop with other middlewares and libraries wihch use the Endpoint Routing APIs.

@64J0
Copy link
Member

64J0 commented Feb 25, 2024

I added to the documentation the information that Giraffe.EndpointRouting is considered best practice with this PR. I assume this is sufficient to close this issue.

Please, open a follow-up issue or start a discussion if you need more clarification or would like to get deeper into this topic.

@64J0 64J0 closed this as completed Feb 25, 2024
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 a pull request may close this issue.

3 participants