[Nitro] Can nitro be used with eruby?
anne at wjh.harvard.edu
Sun Jun 11 09:03:36 EDT 2006
Thank you George.
Installing nitro was not quite as simple as you suggested,
it seemed to require og, glue, facets, redcloth 3.0.3,
ruby-breakpoint (0.5) and daemons (0.4.2)
Thank you for your quick tour on how to get started with
Nitro. Your example separates starting webrick from the
html file structure nitro expects, making it a little
clearer to me, I will play with Nitro a bit, see if I can
get an easy implementation of my exercise.
Thank you Fabian for your response.
since my goal is to understand Web programming (I am working
on the prerequesite exercises for a 2003 web course posted
on the web, so real basic stuff right now), I think I should
use the lightest tool for the task.
Templates vs Framework
All of the frameworks offer a way to map a URL to a template
file. In addition to simple mappings similar to the handling
of static documents, some offer ways to intercept all
requests within a certain directory for pre-processing, or
create an object inheritance scheme out of the directory
structure of a site.
As I understand it, eruby is a pre-processor. When you try
to access an rhtml file, eruby is called first, runs, is
replaced by the result of the computation, and then the
browser presents the resulting html file.
A framework is just a bunch of code. Since you say Rails is
based on erb, I should be able to recreate Rails like
behavior out of just ruby and erb.
When the browser receives a pgm.rhtml request, it looks for
a pgm.rhtml file in the given directory.
With the frameworks rails and nitro, somehow running nitro
links up a directory to an address localhost:9999, and then
any address down stream from that adress is captured by the
program and redirected by it.
Right now I can't see how to get that kind of basic behavior
with eruby, since there must be an exact match one to one
between an url and a file. Yet you tell me that rails does
it with erb. and erb and eruby are very similar. What is the
key idea I am missing?
More information about the Nitro-general