Dynamic Routing with Circuit
summary
Circuit is a Ruby gem that lets a single Rack server route many domains to different Rack apps and middleware, configured at runtime from a datastore. It uses a cru file and a Site/Node model (Mongoid example shown) to map hosts and aliases to behavior classes, includes a request rewriter to forward paths into downstream Rails routes, and runs in production at about 30-40k requests/day. Current back ends are in-memory and MongoDB, Redis and ActiveRecord adapters are requested.
AI-written summary · about
chapters (9)
- 0:00Start
- 5:30Add New Domains
- 9:40Rack Middleware
- 9:53What Rack Middleware Is
- 13:38Push Notification Updates
- 16:09Code Example
- 18:23Model for a Site
- 21:07Behavior Class
- 22:56Rewriter
related talks
39mRoda: The Routing Tree Web Framework
30mThe Power of Middleware - Building Your Own Mini Web Framework on Rack
28mBetter Routing Through Trees
44mBuilding Distributed Applications
26mRuby off the Rails: Building a distributed system in Ruby
37mRuby on Rack: The Magic Between Request and Response
41mRack - A Framework to Roll Your Own
30mWeb Applications with Ruby (not Rails)
