I need to write a super fast Ruby application to process web requests on Sinatra - and want to run it on the Ebb webserver. But I cannot work out how to do this. Could someone please help me?
+1
A:
You need to look at Rack: http://rack.rubyforge.org/ It's pretty easy really, you have a .ru file which instructs Rack how to start your application, and in your application you have a 'call' method which is called on each request, and sends the response back to Rack.
In my_app.ru
require 'my_app'
require 'ebb'
# Rack config
use Rack::Static, urls: ['/js', '/public', '/index.html']
use Rack::ShowExceptions
# Run application
run MyApp.new
In my_app.rb
class MyApp
def call env
request = Rack::Request.new env
response = Rack::Response.new
params = request.params
response.body = "Hello World"
response['Content-Length'] = response.body.size.to_s
response.finish
end
end
Then you specify the .ru file in your sinatra config, like:
rackup: my_app.ru
cloudhead
2009-06-12 03:36:34
I dont see how the sinatra bit falls into this....where is the sinatra code? In my_app.ru?
Ash
2009-06-12 06:02:14
It also turns out that ebb isnt available on Windows...does the same process apply to lighttpd?
Ash
2009-06-12 06:03:09
If you're looking for a high-performance server, Nginx is pretty popular for Ruby apps these days, and I've seen it beat Lighttpd in tests.
Chuck
2009-06-12 09:02:47
but they're not available for Windows are they? :(
Ash
2009-06-16 05:00:58
+1
A:
sinatra has a -s option to specify a handler. try running your app with -s ebb.
Martin DeMello
2009-06-12 08:24:15