Created
May 3, 2011 10:17
-
-
Save bernd/953111 to your computer and use it in GitHub Desktop.
Trying a modular sinatra app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'post' | |
class App < Sinatra::Base | |
include Post | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
$LOAD_PATH.unshift File.dirname(__FILE__) | |
require 'app' | |
run App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Post | |
def self.included(base) | |
base.class_eval do | |
post '/post' do | |
content_type :text | |
"POST\n" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment