Created
March 21, 2014 13:37
-
-
Save cranic/9686415 to your computer and use it in GitHub Desktop.
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
// 1 - try / catch doesn't work with async codes, so you don't need to use | |
// 2 - You need to add a callback to be trigered when everything had run | |
module.exports = { | |
createNewUser: function (user, callback){ | |
connection.query('INSERT INTO users (email, first_name, last_name, password) VALUES ("?", "?", "?", "?")', [user.email, user.first_name, user.last_name, user.password], function(err, result) { | |
// We will pass the error and the result to the function | |
callback(err, result); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment