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

Add new route functions (...WithExtensions) + .NET 8 and 9 #634

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

64J0
Copy link
Member

@64J0 64J0 commented Dec 19, 2024

Description

With this PR, I'm adding a new alpha endpoint routing functions based on what was presented at PR #619. The new routing functions are:

  • routeWithExtensions
  • routefWithExtensions
  • subRouteWithExtensions

There is a new sample showing how to use it with ASP.NET's Rate limiting middleware, a new docs section was added to explain this new feature and more unit tests were added.

As a side-effect of this new feature, the minor .NET version was bumped to 8.0, so some packages were updated accordingly. CI as well.

In the long run my plan is to add new extensions and improve the ones we currently have (this is in alpha as explained by the docs).

How to test

  • Check the CI;
  • Check the new sample.

Related issues

@64J0 64J0 changed the title Add new route functions Add new route functions (...WithExtensions) Dec 19, 2024
@64J0 64J0 changed the title Add new route functions (...WithExtensions) Add new route functions (...WithExtensions) + .NET 8 and 9 Dec 19, 2024
@64J0 64J0 self-assigned this Dec 19, 2024
@@ -156,29 +157,71 @@ module Routers =
| CONNECT -> "CONNECT"
| _ -> ""

[<RequireQualifiedAccess>]
type AspNetExtension =
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan the DU. This means if someone wants to extend this functionality they have to edit giraffe source code. And if they're doing something custom it's not something we'd want to accept.

It would be better to have a list of IEndpointConventionBuilder -> IEndpointConventionBuilder/unit functions and maybe provide helpers for known ones we'd want to support.

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

From afar this looks good, I agree with Jimmy his comment.

@64J0 64J0 marked this pull request as draft December 20, 2024 11:05
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.

3 participants