Skip to content

Commit

Permalink
renamed var.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbuddy committed Jan 18, 2010
1 parent 73f2b1c commit 418c163
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -135,7 +135,7 @@ To use this within Node.js, simply use the Node.js interface. Here is a simple e
}}, }},
'/hello/:name': {to: function (request, response) { '/hello/:name': {to: function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"}); response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Hello "+request.sherpa_response.params['name']+"\n"); response.sendBody("Hello "+request.sherpaResponse.params['name']+"\n");
response.finish(); response.finish();
}}, }},
'not found': {to: function (request, response) { 'not found': {to: function (request, response) {
Expand Down
9 changes: 4 additions & 5 deletions exmaples/node-example.js
@@ -1,15 +1,16 @@
require('../lib/sherpa') require('../lib/sherpa')


var sys = require("sys"), http = require("http"); var sys = require("sys"), http = require("http");
var sherpa = new Sherpa.interfaces.NodeJs({
http.createServer(new Sherpa.interfaces.NodeJs({
'/hello': {to: function (request, response) { '/hello': {to: function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"}); response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Hello World\n"); response.sendBody("Hello World\n");
response.finish(); response.finish();
}}, }},
'/hello/:name': {to: function (request, response) { '/hello/:name': {to: function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"}); response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Hello "+request.sherpa_response.params['name']+"\n"); response.sendBody("Hello "+request.sherpaResponse.params['name']+"\n");
response.finish(); response.finish();
}}, }},
'not found': {to: function (request, response) { 'not found': {to: function (request, response) {
Expand All @@ -18,9 +19,7 @@ var sherpa = new Sherpa.interfaces.NodeJs({
response.finish(); response.finish();
}} }}


}); }).listener()).listen(8000);

http.createServer(sherpa.listener()).listen(8000);
sys.puts("Server running at http://127.0.0.1:8000/"); sys.puts("Server running at http://127.0.0.1:8000/");




2 changes: 1 addition & 1 deletion lib/sherpa.js
Expand Up @@ -335,7 +335,7 @@ Sherpa.interfaces.NodeJs.prototype = {
return function(httpRequest, httpResponse) { return function(httpRequest, httpResponse) {
var response = router.recognize(httpRequest.uri.path, httpRequest); var response = router.recognize(httpRequest.uri.path, httpRequest);
if (response) { if (response) {
httpRequest.sherpa_response = response; httpRequest.sherpaResponse = response;
response.destination(httpRequest, httpResponse); response.destination(httpRequest, httpResponse);
} else { } else {
notFound(httpRequest, httpResponse); notFound(httpRequest, httpResponse);
Expand Down

0 comments on commit 418c163

Please sign in to comment.