A Simple Domain-Specific Language

Sinatra takes advantage of Ruby’s elegant syntax to define a simple domain-specific language (DSL) for implementing web applications. Method calls like get, put, and post correspond to the HTTP method of the request. When the method and the URI match, the code block handles the request and returns the result as an HTTP response. This DSL provides an expressive and natural way of developing a web application. Sinatra is particularly well suited to build a server that provides a RESTful API to its clients.

Sinatra is a very lightweight framework with few dependencies. Getting started and developing an application are effortless. Our example will be a bookmarking application: users can save and view their bookmarks, ...

Get Seven Web Frameworks in Seven Weeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.