Simple ruby web server

Hi all,

I’m looking for a simple webserver that could handle basic requests
(mostly from a localhost) outputing html files. It should also be able
to get the input from forms. Rails seems too powerful to perform such
a simple class.

Sorry if this sounds confusing. I’m a newcomer to the ruby language.

Quoth Filipe:

Hi all,

I’m looking for a simple webserver that could handle basic requests
(mostly from a localhost) outputing html files. It should also be able
to get the input from forms. Rails seems too powerful to perform such
a simple class.

Sorry if this sounds confusing. I’m a newcomer to the ruby language.

Look into WEBrick / GServer.

On Oct 4, 10:09 pm, Konrad M. [email protected] wrote:

Look into WEBrick / GServer.


Konrad M. [email protected]http://konrad.sobertillnoon.com/

signature.asc
1KDownload

#!/bin/env ruby
require ‘webrick’
include WEBrick

s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd
)

trap(“INT”){ s.shutdown }
s.start

Run that in a directory with html files. That will serve them up for
ya, then go from there.

If you want a small mvc pattern, then check out camping. A little
more in-depth but smaller than rails is merb. I prefer merb myself.

On Oct 4, 2007, at 8:50 PM, Filipe wrote:

Hi all,

I’m looking for a simple webserver that could handle basic requests
(mostly from a localhost) outputing html files. It should also be able
to get the input from forms. Rails seems too powerful to perform such
a simple class.

Sorry if this sounds confusing. I’m a newcomer to the ruby language.

Rails isn’t a web server.
Apache is a web server.
Rails is (like any web framework) a glorified CGI program.
There is Merb, and Camping, and Ruby does have a CGI class…

dusty wrote:

If you want a small mvc pattern, then check out camping. A little
more in-depth but smaller than rails is merb. I prefer merb myself.

Also look at Nitro and Ramaze, both of which make it quite simple to
develop Web sites using a range of techniques, from all-in-one-file to
full-blown MVC, with or without a database.


James B.

“Every object obscures another object.”
- Luis Bunuel

Filipe wrote:

Webrick seems to be what I’m looking for. However I couldn’t find any
tutorial/sample or documentation for it. Is there any sample avaliable
on the web?

http://segment7.net/projects/ruby/WEBrick/


James B.

“Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety.”

  • Benjamin Franklin, when asked about static typing
    (and a tip of the hat to raganwald)

On Oct 5, 2:15 am, James B. [email protected] wrote:

James B.

“Every object obscures another object.”
- Luis Bunuel

Webrick seems to be what I’m looking for. However I couldn’t find any
tutorial/sample or documentation for it. Is there any sample avaliable
on the web?