私は複数のウェブサイトを運営するRackサーバーを持っています。一部のミドルウェアは特定のRackウェブサイトでのみ使用します
use Rack::Session::Cookie
app = lambda do |env|
case
# Kek Mobile
when env['HTTP_HOST'] =~ /mobi.kek.com/
require ::File.expand_path(::File.join(::File.dirname(__FILE__),'code','kek_mobile','main.rb'))
selectedApp = KekMobile.new
# Kek Facebook App
when env['HTTP_HOST'] =~ /fb.kek.com/
require ::File.expand_path(::File.join(::File.dirname(__FILE__),'code','facebook','main.rb'))
selectedApp = Facebook.new
else #we launch the corp website
require ::File.expand_path(::File.join(::File.dirname(__FILE__),'code','corp','main.rb'))
selectedApp = Corp.new
end
selectedApp.call env
end
run app
私はいくつかのラックミドルウェアを使用しようとしていますが、私はすべてのウェブサイトでそれらを使用したくありません。たとえば、FacebookのアプリのウェブサイトにのみOAuthミドルウェアを使用したいと考えています。 私はミドルウェアをwhenステートメントまたはウェブサイトmain.rbファイルで使用しようとしましたが、動作しません。 ウェブサイト固有のミドルウェアを起動することは可能ですか?
ありがとうございます。
Thomy
ninjahideoutのリンクがダウンしていて、robots.txtのためにarchive.orgに存在しません。なんて悲しい。 – odigity