Modify Rack App
问题 For one of my ruby applications i need the server to route requests based on the subdomain. There are ways to do this using other gems but i decided to make my own "middleware". This code runs applications based on where the request is going to. config.ru require './subdomain' require './www' run Rack::Subdomain.new([ { :subdomain => "test", :application => Sinatra::Application } ]); subdomain.rb module Rack class Subdomain def initialize(app) @app = app end def call(env) @app.each do |app|