I'm really enjoying hanami/api so far. Is there a way to have shared logic between block contexts? I know I can write my own rack endpoint but I don't want to lose the block context apis, and my shared logic is pretty small at the moment. If not, is there a recommended approach?
Ex:
def my_shared_logic
halt 401 unless authorized?
end
get "/" do
my_shared_logic
"Hello, world"
end
get "/" do
my_shared_logic
"Hello, world"
end
I'm really enjoying hanami/api so far. Is there a way to have shared logic between block contexts? I know I can write my own rack endpoint but I don't want to lose the block context apis, and my shared logic is pretty small at the moment. If not, is there a recommended approach?
Ex: