小编gwi*_*ger的帖子

node.js redis 以及使用模块时如何使用promise

我在节点服务器中有一个这样的 Express 路由(需要文件):

var redis = require('../modules/redis');

module.exports = function (app) {

var redisClient = redis.init();


app.post('/auth/ticket', cors(), function (req, res) {


    var hashes = ['hash1','hash2', 'hash3'];

    var candidates = [];  // An array to collect valid hashes
    var key;  
    // to check each hash against a RedisDB I use a For Loop
    for (key in hashes) {
        var hash = hashes[key];
        console.log("Hash " + hash + "  will be proofed now:");
       //now I try to collect the valid hashes …
Run Code Online (Sandbox Code Playgroud)

javascript redis node.js promise q

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

javascript ×1

node.js ×1

promise ×1

q ×1

redis ×1