module MyEngine class FooController < ::ApplicationController def bar render the: text => "Your text is #{params[:text]}" end end end
gem 'thin' # yes, we're going to use thin! gem 'rack-fiber_pool', :require => 'rack/fiber_pool' # async http requires gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git', :require => 'em-synchrony/em-http' gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http' gem 'addressable', :require => 'addressable/uri'
... use Rack::FiberPool # <-- run HmvcTest::Application
... config.threadsafe! # <-- end end
class HomeController < ApplicationController def index http = EM::HttpRequest.new("http://localhost:3000/foo/bar?text=#{params[:a]}").get render :text => http.response end end
this start
Started GET "/home/index?a=HMVC" for 127.0.0.1 at 2012-02-03 15:27:02 +0400
Processing by HomeController#index as HTML
Parameters: {"a"=>"HMVC"}
Started GET "/foo/bar?text=HMVC" for 127.0.0.1 at 2012-02-03 15:27:02 +0400
Processing by FooController#index as HTML
Parameters: {"text"=>"HMVC"}
Rendered text template (0.0ms)
Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
Rendered text template (0.0ms)
Completed 200 OK in 6ms (Views: 0.4ms | ActiveRecord: 0.0ms)
Source: https://habr.com/ru/post/137558/
All Articles