home.js
883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// # home
exports = module.exports = home
function home(app, lib, modeluser) {
return {
render: function(req, res, next) {
res.render('home')
},
about: function(req, res, next) {
// save project data
var User = modeluser;
console.log(User);
/*var user = new User({
email: 'user@example.com',
});
*/
var upsertData = User;//user.toObject();
delete upsertData._id;
User.update({email: 'user@example.com'}, upsertData, {upsert: true}, function( err, project ) {
if(err){
res.send(500, {message: 'Error saving project data'});
return console.error('Error creating project data');
}
res.send(200, {message: 'success'});
});
res.send(200, 'Hello, this is Igloo.')
}
}
}
exports['@require'] = [ 'mongo', 'redis', 'models/user' ];