Skip to content

Instantly share code, notes, and snippets.

@dunnock
Last active March 1, 2020 11:54
Show Gist options
  • Save dunnock/e2e0480e5aac08f33432962fec7cf1f1 to your computer and use it in GitHub Desktop.
Save dunnock/e2e0480e5aac08f33432962fec7cf1f1 to your computer and use it in GitHub Desktop.
actix-node-benchmark: JavaScript get_tasks handler
router.get('/tasks', (req, res, next) => {
let { assignee_name, summary, limit, full } = req.query;
full = full == "true";
if (!!limit && isNaN(limit)) {
return next(createError({
status: 400,
message: "limit query parameter should be a number"
}));
}
db.get_tasks(assignee_name, summary, limit, full)
.then(tasks => res.send(tasks))
.catch(err => next(createError(err)))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment