Skip to content

Commit

Permalink
[#118674291] Adds Procfile
Browse files Browse the repository at this point in the history
  • Loading branch information
andela-gnyenyeshi committed Apr 29, 2016
1 parent 09e33af commit c5125a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm start
31 changes: 11 additions & 20 deletions server/controllers/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,18 @@
module.exports = {
// Function to create a new member
create: function(req, res) {
// Check if Email exists
Member.findOne(req.body.email, function(err, result) {
if (result) {
return res.status(409).json({
message: 'This Email already exists'
});
} else {
// Instance of the model Member
var member = new Member();
member.name = req.body.name;
member.email = req.body.email;
// Instance of the model Member
var member = new Member();
member.name = req.body.name;
member.email = req.body.email;

member.save(function(err, savedMember) {
if (err) {
console.log(err);
return res.status(500).send(err);
} else {
return res.status(200).json({
message: 'Successfully added new user'
});
}
member.save(function(err, savedMember) {
if (err) {
console.log(err);
return res.status(500).send(err);
} else {
return res.status(200).json({
message: 'Successfully added new user'
});
}
});
Expand Down

0 comments on commit c5125a5

Please sign in to comment.