Skip to content

Instantly share code, notes, and snippets.

@vdeturckheim
Created October 10, 2016 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdeturckheim/bbdd4dfba36212dc7e7fe85fe3d8b18e to your computer and use it in GitHub Desktop.
Save vdeturckheim/bbdd4dfba36212dc7e7fe85fe3d8b18e to your computer and use it in GitHub Desktop.
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