SHARE
TWEET

Untitled

a guest Jun 25th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get("/students/:snumber", function (req, res, next) {
  2. console.log('student number =', req.params.snumber)
  3. next() },
  4.  
  5. function (req, res, next) {
  6. var query = { student_number: req.params.snumber };
  7.  
  8. MongoClient.connect('mongodb://localhost:27017/uni', function (err, client) {
  9. if (err) throw err
  10.     var db = client.db('uni')
  11.     db.collection('students').find(query).toArray(function (err, result) {
  12.     if (err) throw err
  13. console.log(result)
  14. res.send(result)
  15. })
  16. })
  17. });
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