# Outputting to web = Rails or web framework the best?

**URL:** <https://www.ruby-forum.com/t/outputting-to-web-rails-or-web-framework-the-best/121403>\
**Category:** Rails\
**Created:** [November 27, 2007, 5:49pm UTC](https://www.ruby-forum.com/t/outputting-to-web-rails-or-web-framework-the-best/121403 "2007-11-27T17:49:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3bc359/32.png) [@pood](https://www.ruby-forum.com/u/pood)\
**Post date:** [November 27, 2007, 5:49pm UTC](https://www.ruby-forum.com/t/outputting-to-web-rails-or-web-framework-the-best/121403/1 "2007-11-27T17:49:22Z")

</div>

I have a program I wrote in ruby, but I would like to have it accessible  
on the web so my co-workers don’t have to load up a ruby environment.

Would Rails be the way to go?

The program asks for a list of urls and it’ll extract some info off of  
google and output the result.

---

<div class="post-metadata">

**Author:** ![pood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3bc359/32.png) [@pood](https://www.ruby-forum.com/u/pood)\
**Post date:** [November 28, 2007, 12:51am UTC](https://www.ruby-forum.com/t/outputting-to-web-rails-or-web-framework-the-best/121403/2 "2007-11-28T00:51:57Z")

</div>

Rails would be great for something like that. You could also look  
into merb ([merbivore.com](http://merbivore.com)), I enjoy merb a lot and its a little lighter  
than rails. There is also Camping which is even lighter than both.

If you are going the rails route, you may want to look into  
backgroundrb to push your workers extracting those pages to a  
background process. You’d then use javascript to pull in the  
results. That is because rails will lock on your mongrel instance, so  
if there is a delay, others may be hung up trying to access your page.

If you aren’t using activerecord, you can safely turn off the mutex  
lock with merb, by starting it with -X off. I’m doing that right now  
to run similar things, like snmpwalks or extracting external pages and  
inspect them with net/http or open-uri and hpricot.

However, you may even want to simply create a Mongrel handler for  
this, if its that simple.

Check this one out:

require ‘rubygems’  
require ‘mongrel’

class TimeHandler \< Mongrel::HttpHandler  
def process(request,response)  
response.start(200) do |headers, output|  
headers[“Content-Type”] = “text/plain”  
output.write(Time.now)  
end  
end  
end

server = Mongrel::HttpServer.new(“0.0.0.0”, “2222”)  
server.register(“/time”, TimeHandler.new)  
server.run.join

Run that and then go to [http://localhost:2222/time](http://localhost:2222/time)

That should get you started.

On Nov 27, 11:49 am, Feng T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
