node.js - Nodejs function parameters -


i watched online tutorial implementing restful api. used node js mysql database.

i can't understand following function call:

app.route('/users/{id}').get(users.readuserid)  readuserid = function(req, res) {     user.getoneuser(function(result) {         res.json(result);     }); };  getoneuser = function(userid, done) {     db.get().query('select * users user_id = ?', userid, function (err, rows) {         if (err) return done(err);         done(rows);     }); }; 

they in different files (thats why looks nested function call). thing don't understand getoneuser function takes 2 arguments. when readuserid calls it, readuserid inserts 1 argument. how work?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -