Skip to content
Newer
Older
100644 99 lines (66 sloc) 2.38 KB
c48f7b4 Found another instance of Juice
RayMorgan authored
1 Vroom - A simple resource web framework for Node.js
91f681f Added the readme.
RayMorgan authored
2 ===================================================
3
6d2f381 Changing framework name to vroom because there is another JS framewor…
RayMorgan authored
4 Vroom's goals are to be an easy to use web framework
91f681f Added the readme.
RayMorgan authored
5 for building scalable HTTP oriented applications.
6
7
8 ### Core Goals
9
10 * Do NOT mess with Node.js's ability to stream data.
11 * Work with the async nature of Node.js, not against.
12 * Have a simple API (a little magic is fine!)
13 * Have a simple core.
14
15 While I feel that these goals are currently met to certain
16 degrees, I believe there is still a bunch of work to do to
17 fully meet each goal.
18
19
20 ### Routing
21
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
22 Routing is provided by the individual resource type. Each resource
23 type is built upon the Application mounting system built into
24 Vroom. A default PathResource is included and provides a very
25 flexible routing system based on Sinatra + Merb style routing.
91f681f Added the readme.
RayMorgan authored
26
27
28 ### Usage
29
30 For a demo app see: `test/app/`
31
32 Here is a totally simple example app
33
ff02a39 Fix README
RayMorgan authored
34 var Vroom = require("./lib/vroom");
35 var PathResource = require("./lib/vroom/path_resource");
0ae742b Updated README demo to reflect new changes.
RayMorgan authored
36
37 var resource = new PathResource(function (r) {
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
38
7a7ac88 Removing the with statements in the README sample.
RayMorgan authored
39 r.get('/', function () {
2d14da3 Fixed README
RayMorgan authored
40 return "Hello World";
41 });
0ae742b Updated README demo to reflect new changes.
RayMorgan authored
42
7a7ac88 Removing the with statements in the README sample.
RayMorgan authored
43 r.get('/person(/:name)', function (name) {
2d14da3 Fixed README
RayMorgan authored
44 return "Hello: " + (name || "unknown");
45 });
0ae742b Updated README demo to reflect new changes.
RayMorgan authored
46
7a7ac88 Removing the with statements in the README sample.
RayMorgan authored
47 r.get('/stream', function () {
2d14da3 Fixed README
RayMorgan authored
48 this.status = 200;
0ae742b Updated README demo to reflect new changes.
RayMorgan authored
49 this.sendHeader();
2d14da3 Fixed README
RayMorgan authored
50 this.write("Hello ");
51 this.write("World!");
52 this.finish()
53 });
0ae742b Updated README demo to reflect new changes.
RayMorgan authored
54
7a7ac88 Removing the with statements in the README sample.
RayMorgan authored
55 });
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
56
2d14da3 Fixed README
RayMorgan authored
57 var app = new Vroom.Application();
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
58
2d14da3 Fixed README
RayMorgan authored
59 app.config.use(function (c) {
60 c['logLevel'] = 'DEBUG';
61 });
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
62
2d14da3 Fixed README
RayMorgan authored
63 app.mount('root', '/', resource);
64 app.boot();
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
65
66 Since the config/mounting/booting/etc is separate from the
67 resources, each piece can be in its own file as you see fit.
68 See the test/app for a more detailed example with templates
69 and such.
91f681f Added the readme.
RayMorgan authored
70
361ec9c Updated README to show that you don't need to use PathResource if tha…
RayMorgan authored
71 Another thing to see is that Vroom resources are simply functions.
72 This application will work as you would expect:
73
ff02a39 Fix README
RayMorgan authored
74 var Vroom = require("./lib/vroom");
361ec9c Updated README to show that you don't need to use PathResource if tha…
RayMorgan authored
75
76 var app = new Vroom.Application();
77
78 app.mount('stream', '/stream', function () {
79 this.status = 200;
80 this.sendHeader();
81 this.write("Hello ");
82 this.write("World!");
83 this.finish();
84 });
85
86 app.mount('root', '/', function () {
87 return "Hello World";
88 });
89
90 app.boot();
91
0d5a267 Added some more stuff to the README
RayMorgan authored
92 To boot that:
93
94 $ node that-file.js
95
f6ea66c Merged v0.5 into master. Updated README.
RayMorgan authored
96 Note that you need [Node.js](http://tinyclouds.org/node/) installed
97 prior to running the application.
0d5a267 Added some more stuff to the README
RayMorgan authored
98
Something went wrong with that request. Please try again.