Tuesday, 4 April 2017

how to use async.series nodejs?

im having some problems, i need to save all data from the database into var =result[] but im just not getting it. If anyone can help me it will be cool. Im new using async thanks

function getContent() { var result = [];

  async.series([
    getDb,

  ],endFunction);


  function getDb(done) {
        var query = "SELECT title , launch_year FROM content WHERE content_genre_id=1 && content_type_id!=2 LIMIT 2";
        mysqlConnection.query(query, function(err, data) {
            console.log("getting data",data);
            result = data;
            //async.each(resultado, getId, done);
            done();
            return result;
          });
      }
    }   console.log(result);



via juan dubie

No comments:

Post a Comment