Created
October 8, 2017 18:12
-
-
Save NMZivkovic/b35e36076a677ce72d536cde507a656d 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
var router = express.Router(); | |
router.get('/getUsers', function(req, res, next) { | |
var searchQuery = {}; | |
if(req.query.name) | |
searchQuery = { name: req.query.name }; | |
User.find(searchQuery, function(err, users){ | |
if (err) { | |
res.status(400); | |
res.send(); | |
} | |
console.log("returning all the users."); | |
res.send(users); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment