# 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`