grape icon indicating copy to clipboard operation
grape copied to clipboard

Add callbacks around routes

Open TangMonk opened this issue 10 years ago • 3 comments

Just like following:

add after callback to UserApi route with namespace and route "user_api/sign_in"

add_callback :after, "user_api/sign_in" do |params|
   do_something
end

TangMonk avatar Jan 02 '16 09:01 TangMonk

This is not something Grape supports today. It could be implemented though with either existing before / after mechanism (https://github.com/ruby-grape/grape#before-and-after) or in a separate middleware. I think it could be a useful separate gem.

I'm going to label this as a feature request and leave it open for others to comment.

dblock avatar Jan 02 '16 14:01 dblock

Would this be similar to the way rails implements around callbacks?

ochagata avatar Jan 06 '16 20:01 ochagata

Would this be similar to the way rails implements around callbacks?

That's a goal

sasharevzin avatar Jan 26 '23 18:01 sasharevzin