Route Middleware
riteshapatel opened this issue · comments
Ritesh Patel commented
Does Sinatra
support middleware
at route level
? For example, in NodeJS I can do as below.
router.post("/like", validate(generic.FieldValueSchema), catchIt(controller.searchLike))
# validate is simply a generic payload / schema validator
In the event of a wrong payload I want to fail fast and not even reach the route handler.
Or what is the best way to do route level schema validation
in Sinatra?
Any thoughts?