Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created August 20, 2017 15:14
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 conanak99/6524e82f1f11a0dce22b21d662307e1f to your computer and use it in GitHub Desktop.
Save conanak99/6524e82f1f11a0dce22b21d662307e1f to your computer and use it in GitHub Desktop.
app.get('/log', function(request, response) {
// Tìm những log trong database có userId trùng với id trong cookie
// Sắp xếp theo thứ tự thời gian
db.log.find({ userId: request.cookies.id }).sort( {time: -1} , (err, docs) => {
response.json({ id: userId, logs: docs });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment