zoukankan      html  css  js  c++  java
  • thanks使用注意事项;

     1 router.get('/api/users/search/:key/:page', function(req, res) {
     2     if(_.isEmpty(req.params.key)) { res.json({items:null}); return; }
     3 
     4     var key = urlencode.decode(req.params.key);
     5     var page = parseInt(req.params.page);
     6     if(!page) page = 0;
     7     var query = {nickname: new RegExp(key, "i")};
     8     thunk.all([
     9       thunk(function(cb) { User.find(query).skip(page * 40).limit(40).exec(function(err, items) { cb(err, items); }); }),
    10       thunk(function(cb) { User.count(query).exec(function (err, count) { cb(err, count); }); })
    11     ])(function(cb, results) {
    12       res.json({items: results[0], total:results[1]});
    13     });
    14   });

    thunk.all()();

    两个()连用,中间没有then;

    坚持下去就能成功
  • 相关阅读:
    2.7 矩阵的秩
    HDU
    HDU
    HDU
    HDU
    HDU
    hdu 5179 beautiful number(数位dp)
    ACdream
    CodeForces
    <a>标签中 href="/" 和 hideFocus="true"
  • 原文地址:https://www.cnblogs.com/suoking/p/5191781.html
Copyright © 2011-2022 走看看