Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

"Added the pets routing module"

  • Loading branch information...
commit 81c4a17ba91e997f56856bb1eaf3ad6e2651800d 1 parent df137b0
@Aaronontheweb authored
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
20 routes/pets.js
@@ -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 */
+};
Please sign in to comment.
Something went wrong with that request. Please try again.