Skip to content

Instantly share code, notes, and snippets.

@digitalknk
Forked from rmanalan/gist:161461
Created January 8, 2010 11:02
Show Gist options
  • Save digitalknk/271982 to your computer and use it in GitHub Desktop.
Save digitalknk/271982 to your computer and use it in GitHub Desktop.
script/generate plugin HelloWorld
# vendor/plugins/hello_world/init.rb
Rails.configuration.gem "sinatra"
Rails.configuration.middleware.insert_before("ActionController::Failsafe", "HelloWorld")
# vendor/plugins/hello_world/lib/hello_world.rb
# your sinatra app goes here...
require 'sinatra/base'
class HelloWorld < Sinatra::Base
get "/hello" do
"Hello World!"
end
#this hackeration is required for sinatra to be a nice rack citizen
error 404 do
@app.call(env)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment