You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,26 @@
1
-
MVC.js
2
-
======
1
+
Grasshopper
2
+
==========
3
3
4
-
A simple MVC framework for web applications built on [node.JS](http://nodejs.org/). Follow the [instructions to install node.JS](http://nodejs.org/#download). Join the [mailing list](http://groups.google.com/group/mvcjs) for further help and feedback.
4
+
A simple MVC framework for web applications built on [node.JS](http://nodejs.org/). Follow the [instructions to install node.JS](http://nodejs.org/#download). Join the [mailing list](http://groups.google.com/group/grasshopperjs) for further help and feedback.
5
5
6
6
This framework is licensed under the terms of [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
7
7
8
8
Hello World
9
9
-----------
10
10
11
-
1. Clone the repository using `git clone git://github.com/tuxychandru/mvc.js.git`.
12
-
2. Create a directory for your application and copy the `lib` directory from the cloned repository to it.
11
+
1. Clone the repository using `git clone git://github.com/tuxychandru/grasshopper.git`.
12
+
2. Create a directory for your application and copy or symlink the `lib` directory from the cloned repository to it.
13
13
3. Create a file named `hello.js` in your application's directory with the following content.
14
14
15
15
require.paths.unshift('./lib');
16
16
17
-
var mvc = require('mvc');
17
+
var gh = require('grasshopper');
18
18
19
-
mvc.get('/', function() {
19
+
gh.get('/', function() {
20
20
this.renderText('Hello World!');
21
21
});
22
22
23
-
mvc.serve(8080);
23
+
gh.serve(8080);
24
24
25
25
4. From your applications directory invoke the command `node hello.js`.
26
26
5. Point your browser at http://localhost:8080.
@@ -52,26 +52,26 @@ Arguments passed as part of the URL can be obtained with an additional parameter
52
52
53
53
require.paths.unshift('./lib');
54
54
55
-
var mvc = require('mvc');
55
+
var gh = require('grasshopper');
56
56
57
-
mvc.get('/greetings/{name}', function(args) {
57
+
gh.get('/greetings/{name}', function(args) {
58
58
this.model['name'] = args.name;
59
59
this.render('greeting');
60
60
});
61
61
62
-
mvc.serve(8080);
62
+
gh.serve(8080);
63
63
64
64
4. From your applications directory invoke the command `node template.js`.
65
65
5. Point your browser at http://localhost:8080/greetings/ABC.
66
66
67
67
Dependency Injection
68
68
--------------------
69
69
70
-
Hashes containing the necessary dependencies can be added to the `this` context of your controller functions, using the `mvc.addToContext()` function. You can either specify all the hashes to be included in a single invocation or in multiple invocations. For example,
70
+
Hashes containing the necessary dependencies can be added to the `this` context of your controller functions, using the `gh.addToContext()` function. You can either specify all the hashes to be included in a single invocation or in multiple invocations. For example,
71
71
72
72
require.paths.unshift('./lib');
73
73
74
-
var mvc = require('mvc');
74
+
var gh = require('grasshopper');
75
75
76
76
var dependencies = {
77
77
dataService: {
@@ -80,13 +80,13 @@ Hashes containing the necessary dependencies can be added to the `this` context
80
80
}
81
81
}
82
82
};
83
-
mvc.addToContext(dependencies);
83
+
gh.addToContext(dependencies);
84
84
85
-
mvc.get('/', function() {
85
+
gh.get('/', function() {
86
86
this.renderText('There are ' + this.dataService.getStock() + ' units in stock!');
0 commit comments