Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7988935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:36:11+00:00 2026-06-04T12:36:11+00:00

I am new to node.js and express.js. I know this is a little bit

  • 0

I am new to node.js and express.js. I know this is a little bit silly, but I really don’t know how to solve this problem. Hope there is someone can help me.

I have some information stored in Redis.

redis 127.0.0.1:6379> hgetall "store1"
1) "apple"
2) "10"
3) "banana"
4) "15"
5) "pear"
6) "20"
7) "name"
8) "A Street"
redis 127.0.0.1:6379> hgetall "store2"
1) "apple"
2) "30"
3) "banana"
4) "40"
5) "pear"
6) "50"
7) "name"
8) "B Street"

I want to show these information in a table. Using express.js, I created the following routes file.

routes/report.js

var redis = require('redis'),
    redisclient = redis.createClient();

exports.index = function(req, res){
  redisclient.on("error", function (err) {
      console.log("Error " + err);
  });

  var reports = [];
  redisclient.keys("*", function(err, stores) {
    for (var store in stores) {
      redisclient.hgetall(store, function(err, figures) {
        reports.push(figures);
      });
    }
  });

  res.render('report', { title: 'Store Report', reports: reports });
};

And also the following jade view files.

views/report.jade

h1= title
table(class="table table-striped table-condensed")
  thead
    tr
      th store
      th apple
      th banana
      th pear

  tbody
  - each report in reports
    !=partial('partials/record', {store:record.name, apple:record.apple, banana:record.banana, pear:record.pear})

views/partials/record.jade

tr
  td= store
  td= apple
  td= banana
  td= pear

When I open localhost:3000/report, I get the table structure with no content.

I understand that redis call is async. The report.js file rendered the report.jade before redis return any result.

Would anyone please to tell me how can I solve this problem?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:36:12+00:00Added an answer on June 4, 2026 at 12:36 pm

    Try use the async module, execute a callback to render the results when all IO operations are completed.

    Code example from async README:

    async.parallel([
        function(){ ... },
        function(){ ... }
    ], callback);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to Node.js/Express, but I think I'm slowly getting the hang of
I'm relatively new to node.js and it's addons, so this is probably a beginnersquestion.
So I'm new to OAuth and Node.JS, but I have to create a Flickr
I'm new to node, express and jade and I'm making a small app that
Sorry, still reasonably new to Javascript here, so hope this question isn't too embarrassingly
just installed new ubuntu vm to test around with node installed things in this
I'm trying to add a new node to an jQuery SimpleTree , but all
I am trying to programmatically add a new XLink node to an XDocument but
This is a pure best practice question. I am pretty new to Node and
I want to create new node of BeanTreeView, and when I add some node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.