Documentation for Roda (v3.12.0)
README (Introduction to Roda, start here if new)
Here are direct links to the most important pages:
- Roda ClassMethods (used for configuring Roda)
- Roda InstanceMethods (minimal so as not to pollute the scope)
- Roda RequestMethods (all the methods for routing requests, such as r.on)
- Roda ResponseMethods (methods for manipulating the response directly)
Plugins are a very important part of Roda, since by design Roda has a very small core.
Plugins that Ship with Roda
- all_verbs: Adds request routing methods for all http verbs.
- backtracking_array: Allows array matchers to backtrack if later matchers do not match.
- class_level_routing: Adds class level routing methods, for a DSL similar to sinatra.
- error_handler: Adds ability to automatically handle errors raised by the application.
- head: Treat HEAD requests like GET requests with an empty response body.
- hooks: Adds before/after hook methods.
- multi_route: Allows for multiple named route blocks that can be dispatched to inside main route block.
- multi_run: Adds the ability to dispatch to multiple rack applications based on the request path prefix.
- not_allowed: Adds support for automatically returning 405 Method Not Allowed responses.
- not_found: Adds not_found method for handling responses not otherwise handled by a route.
- pass: Adds pass method for skipping the current matching route block as if it didn't match.
- path_rewriter: Adds support for rewriting paths before routing.
- run_append_slash: Makes r.run use "/" instead of "" for app's PATH_INFO
- run_handler: Allows for modifying rack response arrays when using r.run, and continuing routing for 404 responses.
- static_routing: Adds class level static routing methods, for maximum performance when handling static routes (routes without placeholders).
- status_handler: Adds status_handler method for handling responses without bodies for a given status code.
- type_routing: Route based on path extensions and Accept headers.
- unescape_path: Decodes URL-encoded PATH_INFO before routing.
- assets_preloading: Adds support for generating browser-hinting preload link tags and headers.
- branch_locals: Adds ability to specify defaults for template locals on a per-branch basis.
- chunked: Adds support for streaming template responses using Transfer-Encoding: chunked.
- content_for: Allows storage of content in one template and retrieval of that content in a different template.
- h: Adds h method for html escaping.
- json: Allows match blocks to return arrays and hashes, using a json representation as the response body.
- multi_view: Allows for easily setting up routing for rendering multiple views.
- named_templates: Adds the ability to create inline templates by name, instead of storing them in the file system.
- padrino_render: Makes render method that work similarly to Padrino's rendering, using a layout by default.
- partials: Adds partial method for rendering partials (templates prefixed with an underscore).
- precompile_templates: Adds support for precompiling templates, saving memory when using a forking webserver.
- public: Adds support for serving all files in the public directory.
- render: Adds render method for rendering templates, using tilt.
- render_each: Render a template for each value in an enumerable.
- render_locals: Adds ability to specify defaults for template locals.
- static: Adds support for serving static files using Rack::Static.
- streaming: Adds ability to stream responses.
- symbol_views: Allows match blocks to return template name symbols, uses the template view as the response body.
- timestamp_public: Adds support for serving files in the public directory, with paths that change based on file modification time.
- view_options: Allows for setting view options on a per-request basis.
- caching: Adds request and response methods related to http caching.
- content_security_policy: Allows setting an appropriate Content-Security-Policy header for the application/branch/action.
- cookies: Adds response methods for handling cookies.
- default_headers: Allows modifying the default headers for responses.
- default_status: Allows overriding the default status for responses.
- delegate: Adds class methods for creating instance methods that delegate to the request, response, or class.
- delete_empty_headers: Automatically delete response headers with empty values.
- disallow_file_uploads: Disallow multipart file uploads.
- drop_body: Automatically drops response body and Content-Type/Content-Length headers for response statuses indicating no body.
- halt: Augments request halt method for support for setting response status and/or response body.
- module_include: Adds request_module and response_module class methods for adding modules/methods to request/response classes.
- request_aref: Adds configurable handling for  and = request methods.
- request_headers: Adds a headers method to the request object, for easier access to request headers.
- response_request: Gives response object access to request object.
- sinatra_helpers: Port of Sinatra::Helpers methods not covered by other plugins.
- status_303: Uses 303 as the default redirect status for non-GET requests by HTTP 1.1 clients.
- symbol_status: Allows the use of symbols as status codes, converting them to the appropriate integer.
- typecast_params: Allows for easily converting parameter values to explicit types.
- class_matchers: Adds support for handling matchers for arbitrary classes, with support for type conversion.
- empty_root: Makes root matcher match empty string in addition to single slash.
- hash_matcher: Adds hash_matcher class method for easily defining hash matchers.
- header_matchers: Adds matchers using information from the request headers.
- match_affix: Adds support for overriding default prefix/suffix used in match patterns.
- param_matchers: Adds matchers using information from the request params.
- params_capturing: Stores matcher captures in the request params.
- path_matchers: Adds matchers using information from the request path.
- placeholder_string_matchers: Supports placeholders in string for backwards compatibility.
- optimized_string_matchers: Adds performance optimized matchers for single string arguments.
- slash_path_empty: Considers a path of "/" as an empty path when doing a terminal match.
- symbol_matchers: Adds support for symbol-specific matching regexps.
- common_logger: Adds support for logging in common log format.
- csrf: Older CSRF plugin for backwards compatibility using rack_csrf.
- delay_build: Delay building the rack app until Roda.app is called.
- environments: Adds support for handling different execution environments (development/test/production).
- early_hints: Adds support for using 103 Early Hints responses when using a compatible server.
- error_email: Adds ability to easily email a notification when an error is raised by the application, using net/smtp.
- error_mail: Adds ability to easily email a notification when an error is raised by the application, using mail.
- flash: Adds flash handling.
- heartbeat: Adds support for heartbeats.
- indifferent_params: Adds params method for indifferent parameters.
- json_parser: Parses request bodies in JSON format.
- mailer: Adds support for sending emails using the routing tree.
- middleware: Allows the Roda app to be used as middleware by another app.
- middleware_stack: Allows removing middleware and inserting middleware before the end of the stack.
- path: Adds support for named paths.
- route_csrf: Recommended CSRF plugin with request-specific tokens and control over where CSRF tokens are checked during routing.
- sessions: Implements support for encrypted sessions.
- shared_vars: Stores and retrives variables shared between multiple Roda apps.
- strip_path_prefix: Strips prefixes off internal absolute paths, making them relative paths.
- Adding Authentication
- Up and Going in Roda: Static Ruby Websites
- Up and Going in Roda: A Simple Ruby Blog
- Digging ruby from Roda
These projects ship external plugins for Roda:
- autoforme: Adds autoforme method for automatic creation of administrative front-end for Sequel models.
- forme: Adds form method for simple creation of html forms inside erb templates.
- rodauth: Authentication and account management framework.
- roda-action: Resolves actions stored in roda-container.
- roda-auth: Adds authentication support for Roda.
- roda-basic-auth: Adds support for HTTP basic authentication.
- roda-component: Adds realtime components using faye and opal.
- roda-container: Turns application into an inversion of control (IoC) container.
- roda-flow: Changes routing methods to delegate to containers.
- roda-i18n: Adds easy internationalization and localization support.
- roda-mailer_ext: Teach the Roda mailer plugin a few neat tricks.
- roda-mailer_preview: Preview your emails generated by the Roda mailer plugin.
- roda-message_bus: MessageBus Integration for Roda.
- roda-parse-request: Automatically parse JSON and URL-encoded requests.
- roda-rails: Integration for using Roda as Rack middleware in a Rails app.
- roda-route_list: Parses route metadata from comments in an app file, allowing introspection of routes.
- roda-rest_api: Adds support for easily creating RESTful APIs.
- roda-symbolized_params: Adds params method for symbolized params.
- roda-unpoly: Easily integrate Unpoly into your Roda application.
- roda-will_paginate: will_paginate integration for Roda.
- rom-roda: Adds integration with Ruby Object Mapper.
These external projects are related to Roda:
- newrelic-roda: Adds newrelic instrument for Roda.
- roda-bin: Add bin/roda binary for a simple development server that reloads on changes.
- roda-sequel-stack: Application Skeleton For Roda/Sequel stack.
- roda_app: Generator for Roda apps.
- 3.12 | 3.11 | 3.10
- 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | 3.3 | 3.2 | 3.1 | 3.0
- 2.29 | 2.28 | 2.27 | 2.26 | 2.25 | 2.24 | 2.23 | 2.22 | 2.21 | 2.20
- 2.19 | 2.18 | 2.17 | 2.16 | 2.15 | 2.14 | 2.13 | 2.12 | 2.11 | 2.10
- 2.9 | 2.8 | 2.7 | 2.6 | 2.5.1 | 2.5 | 2.4 | 2.3 | 2.2 | 2.1 | 2.0
- 1.3 | 1.2 | 1.1 | 1.0
- "Dynamic routing in Ruby"
- "Roda" Lightning Talk at RailsConf 2015 (4x3 version) (Video, starts about 33:16)
- "Better Routing Through Trees" Presentation at MountainWest RubyConf 2015 (4x3 version (Video)
- "Roda: The Routing Tree Web Framework" Presentation at RubyConf 2014 (4x3 Version) (Video)
Applications Using Roda
Here are some open source applications that use Roda:
- Kontena (Docker Container Management)
- Alienist Viewer (JRuby Memory Dump Viewer)
- golf-score-roda (Backend for golf-score-frontend)
- tus-ruby-server (Backend for Resumable Uploads)
- SPAM (Simple Personal Accounting Manager)
- Giftsmas (Gift Tracking)
- KaeruEra (Exception Tracking)
- Quinto (Version of 1960s 3M Board Game)
- CSPVR (Content-Security-Policy Violation Recorder and Viewer)
- Lila Shell (Basic Chat Application)
- Falcom CD Catalog (Database of Nihon Falcom Albums)
- Forme Demo (Demo Site for Forme)
- AutoForme Demo (Demo Site for AutoForme)
- Rodauth Demo (Demo Site for Rodauth)