SHARE
TWEET

Untitled

a guest Jul 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Score = db.collection('Score')
  2.  
  3.  
  4.  
  5. app.get('/', async (req, res) => {
  6.     const result = await Score.aggregate([
  7.      
  8.       { $sort: {score: -1}},
  9.       { $limit: 10}
  10.      
  11. ])
  12.     console.log("get")
  13.     res.status(200)
  14.     .send(result)
  15. })
  16.  
  17.  
  18. app.post('/', async (req, res) => {
  19.     const result = await Score.insert(req.body)
  20.     console.log("Post")
  21.     res.status(200).send(result)
  22.   })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top