阅读背景:

Why does 'promisify' cause node to ignore a function?

来源:互联网 

I wrote the following code:

我写了以下代码:

var express = require('express');
var app = express();
var Promise = require('bluebird');
var counter = {};
counter.num = 0;

function incr(counter) {
   counter.num = counter.num + 1;
}

app.get('/check', function(req, res) {
   Promise.promisify(console.log)(counter.num)
       .then(Promise.promisify(incr)(counter.num))
       .then(console.log(counter.num));
   res.end("OK");
});

app.listen(4000);
var e



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: