Copilot commented on code in PR #3634: URL: https://github.com/apache/thrift/pull/3634#discussion_r3566669281
########## lib/rb/README.md: ########## @@ -97,6 +97,27 @@ server = Thrift::ThreadedServer.new(processor, server_transport, server.serve ``` +## Rack HTTP Endpoint + +Ruby HTTP transport can be mounted as a Rack application, so applications can +run Thrift on an existing Rack server such as Puma or Falcon. + +```ruby +# config.ru +require 'thrift' +require 'thrift/server/rack_application' + +run Thrift::RackApplication.new(processor) Review Comment: The Rack example uses `processor` without defining what it is, so the snippet is not directly usable/copy-pastable. Adding a brief comment clarifying that `processor` must be a generated Thrift Processor instance (as shown in “Basic Server Usage”) would prevent confusion. ########## lib/rb/README.md: ########## @@ -97,6 +97,27 @@ server = Thrift::ThreadedServer.new(processor, server_transport, server.serve ``` +## Rack HTTP Endpoint + +Ruby HTTP transport can be mounted as a Rack application, so applications can +run Thrift on an existing Rack server such as Puma or Falcon. + +```ruby +# config.ru +require 'thrift' +require 'thrift/server/rack_application' + +run Thrift::RackApplication.new(processor) +``` + +For Rails or another Rack router, mount the endpoint at the route that should +receive Thrift HTTP requests: + +```ruby +# config/routes.rb +mount Thrift::RackApplication.new(processor) => "/thrift" Review Comment: The Rails mounting example also references `processor` without any context. A short comment indicating it should be a generated Thrift Processor instance would make the snippet self-explanatory. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
