Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Middleware #1994

Closed
riteshapatel opened this issue Jan 17, 2024 · 0 comments
Closed

Route Middleware #1994

riteshapatel opened this issue Jan 17, 2024 · 0 comments

Comments

@riteshapatel
Copy link

riteshapatel commented Jan 17, 2024

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?

@sinatra sinatra locked and limited conversation to collaborators Jan 17, 2024
@dentarg dentarg converted this issue into discussion #1995 Jan 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant