From: Zoltan Dezso Date: 2008-03-25T23:55:31+09:00 Subject: Re: How can I develop a Web Application using ruby without rails Pradeep Belagapu 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 You can get information about eruby and mod_ruby (for apache) from this site: 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 -- Posted via http://www.ruby-forum.com/.