meteran / gnext

Web Framework extension for Gin. Offers the API structuring, automates validation and generates documentation. It's fully compatible with the current Gin usages and Gin's middlewares.
https://pkg.go.dev/github.com/meteran/gnext
MIT License
69 stars 5 forks source link

Middlewares per endpoint #14

Open kruczekrobert opened 1 year ago

kruczekrobert commented 1 year ago

It would be useful to add middleware per endpoint

meteran commented 1 year ago

Could you give some use case example?

kruczekrobert commented 1 year ago

Well, it would be extremely useful and convenient for middleware supporting object-level permissions.

e.g.

having an endpoint for get a resource, I would like to determine that Read permissions are enough.

GET(":id", someHandler, ObjectPermissionMiddleware(Read))

but it has to require a Write permission to edit it

PUT(":id", someHandler, ObjectPermissionMiddleware(Write))

busf4ctor commented 11 months ago

Do we have any progress on this? It's a possible fix for #32