Created
February 20, 2018 03:53
-
-
Save darrell-parkhouse5151/c0d8b502aa54c5090df47aaf8b3c7c2f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| router.post('/users/register', function(req, res) { | |
| var username = req.body.username; | |
| var password = req.body.password; | |
| User.findOne({username: username}, function() { | |
| if (err) console.log(err); | |
| if (user) { | |
| res.json('userExists'); | |
| } else { | |
| var user = new User({ | |
| username: username, | |
| passwrod: password | |
| }); | |
| user.save(function(err) { | |
| if (err) { | |
| console.log(err); | |
| } else { | |
| res.json("userRegistered"); | |
| } | |
| }); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment