Rack Router in Sinatra (Padrino)

Hi all

I’m new in ruby and i’ve started learn sinatra framework. My question
about routing.
In some cases, for content sites, we need url similar like:

http://site.com/article-category/articleId-article-slug.html - for
article
http://site.com/article-category - for category

I’m familiar with php yii framework, and it has feature custom url
rules:

I pass article Id into url rule, it loads article data and build complex
url (with category slug and id) for article.

How can I make that with sinatra?

Thank you!