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