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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 [v3 Feature Request]: Grouping - altered middleware behavior #2200

Closed
3 tasks done
acidjazz opened this issue Nov 8, 2022 · 2 comments
Closed
3 tasks done

Comments

@acidjazz
Copy link

acidjazz commented Nov 8, 2022

Feature Description

  • V2 Grouping should be renamed Prefixing - and solely the ability to define a prefix, not actual grouping
  • Grouping should work somewhat how V2 Grouping works, but does not require a prefix

ex: defining a group

authRoutes := app.Group(middleware.Auth)
authRoutes.Get("/me", controllers.AuthMe)

ex: defining a group with a prefix

authRoutes := app.Group(middleware.Auth).Prefix("/auth")
authRoutes.Get("/me", controllers.AuthMe)
  • CHANGE: Grouped middleware should be given the context of each individual route, not the groups route
package middleware

func Auth(c *fiber.Ctx) {
  c.Route() // should be /auth/me - NOT /auth (currently in v2)
}

Other Notes

  • v2 grouping currently adds routes, a GET for each group - this is not neccessary
  • All middleware in groups should only executed w/ the exact context of the routes defined w/in the group

other ideas of grouping

app.Prefix("/auth").Group(middleware.Auth, func(app *fiber.App) {
  app.Get("/me", controllers.AuthMe)
})

I like the 1st example more - just more ideas

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.
@acidjazz acidjazz changed the title 馃殌 [v3 Feature Request]: Grouping - 馃殌 [v3 Feature Request]: Grouping - altered middleware behavior Nov 8, 2022
@splashsky
Copy link

+1, the current grouping behavior is current a major roadblock in my own project at the moment. Being able to simply group routes with a middleware without prefix collision would be an immediate fix to my problems.

@ReneWerner87
Copy link
Member

we have created another concept #2107 2202 as an idea with which this is possible in a contribution package

so i will close this issue

@ReneWerner87 ReneWerner87 added this to the v3 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants