-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from MeeraChandrasekaran/master
added views
- Loading branch information
Showing
7 changed files
with
76 additions
and
35 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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<h2> Thank you for registering with us. Our team will get back to you in 24 hours </h2> |
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
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var mongoose = require('mongoose'); | ||
var sponsor = mongoose.model('Sponsor'); | ||
|
||
module.exports = (function(){ | ||
return { | ||
add_sponsor: function(req, res){ | ||
console.log(req.body); | ||
var newsponsor = new sponsor(req.body); | ||
newsponsor.save(function(err, result){ | ||
if(err){ | ||
console.log('error adding'); | ||
} else { | ||
console.log('successfully added an sponsor'); | ||
res.json({message: 'success'}); | ||
} | ||
}); | ||
}, | ||
|
||
login: function(req,res){ | ||
sponsor.find({},function(err,results){ | ||
if(err){ | ||
console.log('error'); | ||
}else{ | ||
var exists = false; | ||
for(var i=0;i<results.length;i++){ | ||
if(results[i].email == req.body.email){ | ||
exists = true; | ||
var index = i; | ||
} | ||
} | ||
if (exists) { | ||
console.log("found user"); | ||
res.json(results[index]) | ||
} else { | ||
console.log("user not found"); | ||
res.json({error: true}) | ||
} | ||
|
||
} | ||
}) | ||
} | ||
}; | ||
})(); | ||
|
||
|
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