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
Post a Comment