Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Diverge Metal implementation from Rack::Cascade since we want the last app ↵ | Joshua Peek | 2008-12-19 | 1 | -13/+22 |
| | | | | to return its headers and body if the status is a 404. | ||||
* | Cheaper metal cascade | Jeremy Kemper | 2008-12-18 | 1 | -10/+20 |
| | |||||
* | Make generated Metal bits a pure rack endpoint application (not middleware) | Joshua Peek | 2008-12-17 | 1 | -12/+8 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of calling super to pass the request on, return a 404. The modified app looks like this: # app/metal/poller.rb class Poller def self.call(env) if env["PATH_INFO"] =~ /^\/poller/ [200, {"Content-Type" => "text/html"}, "Hello, World!"] else [404, {"Content-Type" => "text/html"}, "Not Found"] end end end But you aren't locked in to just Rails: # app/metal/api.rb require 'sinatra' Sinatra::Application.default_options.merge!(:run => false, :env => :production) Api = Sinatra.application unless defined? Api get '/interesting/new/ideas' do 'Hello Sinatra!' end | ||||
* | Introduce Rails Metal | Joshua Peek | 2008-12-16 | 1 | -0/+21 |
# app/metal/poller.rb class Poller < Rails::Rack::Metal def call(env) if env["PATH_INFO"] =~ /^\/poller/ [200, {"Content-Type" => "application/json"}, Message.recent.to_json] else super end end end * There is a generator to help you get started `script/generate metal poller` * Also, metal bits can be ran standalone with rackup `rackup app/metal/poller.rb` |