Created
October 10, 2016 08:17
-
-
Save vdeturckheim/bbdd4dfba36212dc7e7fe85fe3d8b18e 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
app.post('/documents/find', (req, res) => { | |
if (!req.body.type && !req.body.title) { | |
return res.json([]); | |
} | |
if (req.body.type === "evil projects") { // I don't want people to discover my evli projects, | |
// it would be a shame is 'client.js' contained a method show all the content of the collection here... | |
return res.json([]); | |
} | |
Document.find(req.body).exec() | |
.then((r) => res.json(r)) | |
.catch((err) => res.json(err)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment