ratalada

A DSL for running Rack servers as easily as you can in JavaScript — pattern-match your routes, pick a backend with a require, and run.

In Node you can stand up a server in three lines. In Ruby the same thing usually means a framework, a config file, and a rackup invocation. Ratalada closes that gap:

require "ratalada/puma"

Server.run do |request|
  case request
  in ["GET", "/"] then "hello\n"
  end
end

That’s a whole app. Run the file, and it’s listening on http://127.0.0.1:9292.

How it fits together

Ratalada is two small, swappable pieces:

  • Backends run the Rack app. require "ratalada/puma" or require "ratalada/falcon" picks the server and defines the top-level Server constant.
  • Frontends turn your Server.run block into a Rack app. The default is a pattern-matching router; require "ratalada/sinatra" or require "ratalada/grape" swaps in Sinatra’s or Grape’s DSL on whichever backend you chose.

The core gem has no runtime dependencies of its own — install whichever server you actually run on. The Sinatra and Grape adapters are separate gems (ratalada-sinatra, ratalada-grape), but you install the gem and still require "ratalada/sinatra" — see require semantics.

What’s here


This site uses Just the Docs, a documentation theme for Jekyll.