Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: BinaryMuse/so_5100999
base: master
...
head fork: BinaryMuse/so_5100999
compare: rack
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 24, 2011
Brandon Tilley Implement rack app 627d20f
Commits on Feb 25, 2011
Brandon Tilley Merge branch 'master' into rack 6a8f810
Brandon Tilley Move rack app to middleware 034e7b8
View
5 app/controllers/text_controller.rb
@@ -0,0 +1,5 @@
+class TextController < ApplicationController
+ def hello
+ render :text => "Hello from TextController#hello"
+ end
+end
View
2  config/application.rb
@@ -13,7 +13,7 @@ class Application < Rails::Application
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
- # config.autoload_paths += %W(#{config.root}/extras)
+ config.autoload_paths += %W(#{config.root}/lib)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
View
1  config/initializers/rack.rb
@@ -0,0 +1 @@
+Rails::Application.config.middleware.use Rack::Api::User
View
2  config/routes.rb
@@ -1,4 +1,6 @@
So5100999::Application.routes.draw do
+ root :to => "text#hello"
+
# The priority is based upon order of creation:
# first created -> highest priority.
View
17 lib/rack/api/user.rb
@@ -0,0 +1,17 @@
+module Rack
+ module Api
+ class User
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ if env["PATH_INFO"] =~ /^\/api\/user\//i
+ [200, {}, ["Here it is."]]
+ else
+ @app.call(env)
+ end
+ end
+ end
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.