# How can I develop a Web Application using ruby without rails

**URL:** <https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873>\
**Category:** Ruby\
**Created:** [March 25, 2008, 2:09pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873 "2008-03-25T14:09:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 2:09pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/1 "2008-03-25T14:09:41Z")

</div>

I have an idea about developing web application using Ruby on Rails.  
But I don’t know how to develop a web application using only ruby  
without rails. Is it possible? If possible how can I handle requests,  
actions, responses etc., Please clear my doubt as early as possible.

Thanks

Pradeep Kumar

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 2:18pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/2 "2008-03-25T14:18:49Z")

</div>

2008/3/25, Pradeep B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have an idea about developing web application using Ruby on Rails.  
> But I don’t know how to develop a web application using only ruby  
> without rails. Is it possible? If possible how can I handle requests,  
> actions, responses etc., Please clear my doubt as early as possible.

You can use CGI and there is a class with the same name that helps you  
process requests and create responses.

Then there are various other mechanisms like FastCGI etc.

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 2:40pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/3 "2008-03-25T14:40:14Z")

</div>

Pradeep B. wrote:

> I have an idea about developing web application using Ruby on Rails.  
> But I don’t know how to develop a web application using only ruby  
> without rails. Is it possible? If possible how can I handle requests,  
> actions, responses etc., Please clear my doubt as early as possible.
> 
> Thanks
> 
> Pradeep Kumar

Iowa … Nitro … roll your own

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/4 "2008-03-25T15:00:49Z")

</div>

On Mar 25, 1:09 pm, Pradeep B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have an idea about developing web application using Ruby on Rails.  
> But I don’t know how to develop a web application using only ruby  
> without rails. Is it possible? If possible how can I handle requests,  
> actions, responses etc., Please clear my doubt as early as possible.

Look at Rack: [http://rack.rubyforge.org/](http://rack.rubyforge.org/)

It gives you a thin web-server independent layer that also tie in  
nicely with a large number of frameworks, and at the same time is  
simple enough that you can trivially write an application without a  
framework if you prefer. The code I run my site and my blog on at  
[http://www.hokstad.com/](http://www.hokstad.com/) is built using only Rack and no framework,  
combined with various self contained libraries, for example so it’s  
absolutely doable.

Vidar

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 4:08pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/5 "2008-03-25T16:08:11Z")

</div>

Take look at my framework named vintage (it’s on Rubyforge). That  
uses Rack to create a rather barebones web framework. It’d probably  
be a good starting point to learn from or use directly.

–Jeremy

On Tue, Mar 25, 2008 at 9:09 AM, Pradeep B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

–  
[http://jeremymcanally.com/](http://jeremymcanally.com/)  
[http://entp.com](http://entp.com)

Read my books:  
Ruby in Practice ([Ruby in Practice](http://manning.com/mcanally/))  
My free Ruby e-book ([http://humblelittlerubybook.com/](http://humblelittlerubybook.com/))

Or, my blogs:

> **[Site not found · DreamHost](http://mrneighborly.com)**
>
> The owner of this domain has not yet uploaded their website.

[http://rubyinpractice.com](http://rubyinpractice.com)

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 3:55pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/6 "2008-03-25T15:55:39Z")

</div>

Pradeep B. wrote:

> I have an idea about developing web application using Ruby on Rails.  
> But I don’t know how to develop a web application using only ruby  
> without rails. Is it possible? If possible how can I handle requests,  
> actions, responses etc., Please clear my doubt as early as possible.
> 
> Thanks
> 
> Pradeep Kumar

Hi,

I am currently developing Ruby (not rails) web applications for mobile  
phones - so yes, you don’t need rails.

To get some basic information about the cgi version, i recommend  
starting here:  
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html](http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html)

You can get information about eruby and mod\_ruby (for apache) from this  
site:  
[http://modruby.org/en/](http://modruby.org/en/)

These are not frameworks, they just execute ruby code. If you are using  
apache, it is fairly straightforward to set up the eruby executable to  
handle your requests for you and you just basically embed ruby inside  
html like this:

This is HTML
\<% print "this is ruby" %\> etc. A tutorial can be found here: http://www.hiveminds.co.uk/node/3094

With mod\_ruby or fastcgi, you can get even more control over the  
response, you can create a small ruby program that catches the request  
and generates the whole response.

print “HTTP/1.1 200 OK\n”  
print “Content-Type: text/plain\n\n”  
print ‘Static text.’

is a very simple handler that just displays that static text. Of course,  
as Robert mentioned before, you can use CGI to help you, like:  
require ‘cgi’  
c = CGI.new  
print c.header(‘type’=\>‘text/plain’)  
print ‘Static text.’

Hope this helps.

Zaki

---

<div class="post-metadata">

**Author:** ![deepkumarb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c4cdca/32.png) [@deepkumarb](https://www.ruby-forum.com/u/deepkumarb)\
**Post date:** [March 25, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/how-can-i-develop-a-web-application-using-ruby-without-rails/132873/7 "2008-03-25T16:32:34Z")

</div>

Try merb.

```
   http://merbivore.com/

```

Also, here is an article that goes over 10 other ruby web frameworks  
besides rails.

[10 Alternative Ruby Web Frameworks | Accidental Technologist (old)](http://rbazinet.wordpress.com/2008/01/14/10-alternative-ruby-web-frameworks/)

Zoltan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Pradeep B. wrote:

> I have an idea about developing web application using Ruby on Rails.  
> But I don’t know how to develop a web application using only ruby  
> without rails. Is it possible? If possible how can I handle requests,  
> actions, responses etc., Please clear my doubt as early as possible.
> 
> Thanks
> 
> Pradeep Kumar

Hi,

I am currently developing Ruby (not rails) web applications for mobile  
phones - so yes, you don’t need rails.

To get some basic information about the cgi version, i recommend  
starting here:  
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html](http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html)

You can get information about eruby and mod\_ruby (for apache) from this  
site:  
[http://modruby.org/en/](http://modruby.org/en/)

These are not frameworks, they just execute ruby code. If you are using  
apache, it is fairly straightforward to set up the eruby executable to  
handle your requests for you and you just basically embed ruby inside  
html like this:  
This is HTML

etc.  
A tutorial can be found here: [http://www.hiveminds.co.uk/node/3094](http://www.hiveminds.co.uk/node/3094)

With mod\_ruby or fastcgi, you can get even more control over the  
response, you can create a small ruby program that catches the request  
and generates the whole response.

print “HTTP/1.1 200 OK\n”  
print “Content-Type: text/plain\n\n”  
print ‘Static text.’

is a very simple handler that just displays that static text. Of course,  
as Robert mentioned before, you can use CGI to help you, like:  
require ‘cgi’  
c = CGI.new  
print c.header(‘type’=\>‘text/plain’)  
print ‘Static text.’

Hope this helps.

## Zaki

Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
