-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified index controller and template to present a list of products
- Loading branch information
lmarkus
committed
Dec 5, 2013
1 parent
e9037fc
commit 479a974
Showing
2 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
'use strict'; | ||
|
||
var Product = require('../models/productModel'); | ||
|
||
module.exports = function (server) { | ||
|
||
/** | ||
* Display a list of the products. | ||
*/ | ||
server.get('/', function (req, res) { | ||
var model = { name: 'kraken-example-shopping-cart' }; | ||
|
||
res.render('index', model); | ||
|
||
|
||
Product.find(function (err, prods) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
|
||
var model = | ||
{ | ||
products: prods | ||
}; | ||
|
||
res.render('index', model); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters