Permalink
Browse files

add another route example to express(1) so people are not so confused

  • Loading branch information...
1 parent f7c1c63 commit 4403f136b7a57751aa5534f9dccc474d30edae64 @tj tj committed Aug 28, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 bin/express
View
@@ -55,6 +55,21 @@ var index = [
].join(eol);
/**
+ * Routes users template.
+ */
+
+var users = [
+ ''
+ , '/*'
+ , ' * GET users listing.'
+ , ' */'
+ , ''
+ , 'exports.list = function(req, res){'
+ , ' res.send("respond with a resource");'
+ , '};'
+].join(eol);
+
+/**
* Jade layout template.
*/
@@ -195,6 +210,7 @@ var app = [
, ''
, 'var express = require(\'express\')'
, ' , routes = require(\'./routes\')'
+ , ' , user = require(\'./routes/user\')'
, ' , http = require(\'http\')'
, ' , path = require(\'path\');'
, ''
@@ -217,6 +233,7 @@ var app = [
, '});'
, ''
, 'app.get(\'/\', routes.index);'
+ , 'app.get(\'/users\', user.list);'
, ''
, 'http.createServer(app).listen(app.get(\'port\'), function(){'
, ' console.log("Express server listening on port " + app.get(\'port\'));'
@@ -280,6 +297,7 @@ function createApplicationAt(path) {
mkdir(path + '/routes', function(){
write(path + '/routes/index.js', index);
+ write(path + '/routes/user.js', users);
});
mkdir(path + '/views', function(){

0 comments on commit 4403f13

Please sign in to comment.