Permalink
Browse files

"Added the pets routing module"

  • Loading branch information...
1 parent df137b0 commit 81c4a17ba91e997f56856bb1eaf3ad6e2651800d @Aaronontheweb committed Feb 18, 2012
Showing with 21 additions and 0 deletions.
  1. +1 −0 app.js
  2. +20 −0 routes/pets.js
View
1 app.js
@@ -28,6 +28,7 @@ app.configure('production', function(){
// Routes
require('./routes/site')(app);
+require('./routes/pets')(app);
app.listen(process.env.PORT || 3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
View
@@ -0,0 +1,20 @@
+/*
+ * MODULE DEPENDENCIES
+ */
+
+var petStore = require('../models/pets');
+var Pets = new petStore("McAwesome Pets", true);
+
+module.exports = function(app){
+ /* Params */
+
+ /* Routes */
+ app.get('/pets/list', function(req, res){
+ Pets.list(30, function(error, data){
+ if(error) return res.render('dead_pets', {title:"Your pets are dead" + Pets.PetStoreName, error:error});
+ res.render('pets/list', {title: 'Your Pets ' + Pets.PetStoreName, pets:data});
+ });
+ });
+
+ /* Catch-alls */
+};

0 comments on commit 81c4a17

Please sign in to comment.