Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get a base for routes and controllers

  • Loading branch information...
commit d18736c7f984a1edcdcd7f4ab0d20c7a9e510b26 1 parent 2ca29c5
@Floby authored
Showing with 17 additions and 6 deletions.
  1. +2 −6 app.js
  2. +15 −0 controller/setup.js
View
8 app.js
@@ -28,12 +28,8 @@ app.configure('production', function(){
});
// Routes
-
-app.get('/', function(req, res){
- res.render('index', {
- title: 'Express'
- });
-});
+var setup_routes = require('./controller/setup').setup_routes;
+setup_routes(app);
// Only listen on $ node app.js
View
15 controller/setup.js
@@ -0,0 +1,15 @@
+function controller (name) {
+ return function route(req, res, next) {
+ res.end("you've got yourself a knot ;)\n");
+ }
+}
+
+exports.setup_routes = function setup_routes (app) {
+ app.get('/', function(req, res){
+ res.render('index', {
+ title: 'Nigel'
+ });
+ });
+
+ app.get('/knots/:id?', controller('knots'));
+}
Please sign in to comment.
Something went wrong with that request. Please try again.