Skip to content

Commit

Permalink
Updated MVC example
Browse files Browse the repository at this point in the history
  • Loading branch information
jarradseers committed Oct 16, 2012
1 parent bf6dd3f commit e8aec2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
11 changes: 7 additions & 4 deletions examples/mvc/controllers/site.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module.exports = function(app) {

exports.index = function(req, res, next) {
var User = req.app.models.user;

User.findById(0, function(user) {
res.send('Here is a user: ' + user.name + ' - ' + user.email);
});
this.index = function(req, res, next) {
User.findById(0, function(user) {
res.send('Have a user: ' + user.name + ' - ' + user.email);
});
};

};
16 changes: 10 additions & 6 deletions examples/mvc/controllers/user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
exports.isAuthenticated = function(req, res, next) {
if (true) {
next();
} else {
res.send('Not authenticated');
}
module.exports = function(app) {

this.isAuthenticated = function(req, res, next) {
if (true) {
next();
} else {
res.send('Not authenticated');
}
};

};

0 comments on commit e8aec2a

Please sign in to comment.