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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -