Make Rails controllers look like Sinatra.
class ShowoffController < ApplicationController
include Sinatrify::DSL
get "/greet" do
render :text => "Hello!"
end
endAdd it to the Gemfile
gem "sinatrify"Bundle it with bundle.
Sinatrify doesn't include its DSL into controllers automatically. You should do so manually for each controller, like in the above example.
Mount your sinatrified controller somewhere
# in config/routes.rb
mount lambda { |env| ShowoffController.call(env) } => "/api"lambda is used here so your code gets reloaded in development.
Works on Rails >3.0 only.
Check out the example_app folder.
Run rake test for specs and rake appraise for features.
Pull requests welcome!