# cat config.ru
require "roda"
class App < Roda
route do |r|
# GET / request
r.root do
r.redirect "/hello"
end
# /hello branch
r.on "hello" do
# Set variable for all routes in /hello branch
@greeting = 'Hello'
# GET /hello/world request
r.get "world" do
"#{@greeting} world!"
end
# /hello request
r.is do
# GET /hello request
r.get do
"#{@greeting}!"
end
# POST /hello request
r.post do
puts "Someone said #{@greeting}!"
r.redirect
end
end
end
end
end
run App.freeze.app
A Modular, Scalable Ruby Framework
-
Built on Rack
Ruby's de facto webserver interface.
-
Flexible Architecture
Any design pattern for any application.
-
Rich Set of Included Plugins
Tools for every aspect of web development.
-
Simple, Reliable API
Currently at version 3.99.0
-
Security Focused
Encrypted sessions, per-form CSRF tokens.
-
Streaming Views & Assets
Mailers, JSON APIs, and more...
Stable for 10+ years, and constantly improving!
RubyConf 2024 - 10 Years of Roda
Watch Roda's lead developer discuss the history of Roda, and the improvements made in Roda's first 10 years.
Comparison to Popular Ruby Web Frameworks
Compared to other popular Ruby web frameworks, Roda has the highest performance (note log10 scale in request per second graph) and uses the least memory.
Data: Requests/Second | Initial Memory Usage
Compare to Sinatra
Roda aims to take the ease of development and understanding that Sinatra brings, and enable it to scale to support the development of large web applications.
Continue Reading