Skip to content

Instantly share code, notes, and snippets.

@zahqresh
Created July 19, 2021 04:24
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 zahqresh/a56b4d0ad6409e5250545ab6225fcca7 to your computer and use it in GitHub Desktop.
Save zahqresh/a56b4d0ad6409e5250545ab6225fcca7 to your computer and use it in GitHub Desktop.
app.get('/api/search/:name', (req, res) => {
const {
name
} = req.params;
db.find({ file_name: name }).then(doc => {
let annotations = [];
doc.forEach(n => {
annotations.push(n.rows);
});
res.json({
total: doc.length,
rows: annotations
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment