public
Description: Vroom is a simple resource oriented web framework built on top of Node.js
Homepage:
Clone URL: git://github.com/raycmorgan/vroom.git
vroom /
name age message
file .gitignore Thu Nov 05 21:27:17 -0800 2009 Fixed all of the issue that came with the API c... [raycmorgan]
file LICENSE Wed Jul 15 00:26:04 -0700 2009 Added License file... just because [RayMorgan]
file README.markdown Thu Nov 05 21:28:51 -0800 2009 Fix README [raycmorgan]
directory lib/ Thu Nov 05 21:27:17 -0800 2009 Fixed all of the issue that came with the API c... [raycmorgan]
directory test/ Thu Nov 05 21:27:17 -0800 2009 Fixed all of the issue that came with the API c... [raycmorgan]
README.markdown

Vroom - A simple resource web framework for Node.js

Vroom's goals are to be an easy to use web framework for building scalable HTTP oriented applications.

Core Goals

* Do NOT mess with Node.js's ability to stream data.
* Work with the async nature of Node.js, not against.
* Have a simple API (a little magic is fine!)
* Have a simple core.

While I feel that these goals are currently met to certain degrees, I believe there is still a bunch of work to do to fully meet each goal.

Routing

Routing is provided by the individual resource type. Each resource type is built upon the Application mounting system built into Vroom. A default PathResource is included and provides a very flexible routing system based on Sinatra + Merb style routing.

Usage

For a demo app see: test/app/

Here is a totally simple example app

var Vroom = require("./lib/vroom");
var PathResource = require("./lib/vroom/path_resource");

var resource = new PathResource(function (r) {

  r.get('/', function () {
    return "Hello World";
  });

  r.get('/person(/:name)', function (name) {
    return "Hello: " + (name || "unknown");
  });

  r.get('/stream', function () {
    this.status = 200;
    this.sendHeader();
    this.write("Hello ");
    this.write("World!");
    this.finish()
  });

});

var app = new Vroom.Application();

app.config.use(function (c) {
  c['logLevel'] = 'DEBUG';
});

app.mount('root', '/', resource);
app.boot();

Since the config/mounting/booting/etc is separate from the resources, each piece can be in its own file as you see fit. See the test/app for a more detailed example with templates and such.

Another thing to see is that Vroom resources are simply functions. This application will work as you would expect:

var Vroom = require("./lib/vroom");

var app = new Vroom.Application();

app.mount('stream', '/stream', function () {
  this.status = 200;
  this.sendHeader();
  this.write("Hello ");
  this.write("World!");
  this.finish();
});

app.mount('root', '/', function () {
  return "Hello World";
});

app.boot();

To boot that:

$ node that-file.js

Note that you need Node.js installed prior to running the application.