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

  • Home
  • SEARCH
  • 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 9265333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:02:46+00:00 2026-06-18T14:02:46+00:00

I wanted to try out example application from http://expressjs.com/guide.html so I wrote the following

  • 0

I wanted to try out example application from http://expressjs.com/guide.html so I wrote the following :

var express = require('express')
var redis = require('redis')
var db = redis.createClient();
var app = express();

app.use(function(req, res, next){
  var ua = req.headers['user-agent'];
  db.zadd('online', Date.now(), ua, next);
});

app.use(function(req, res, next){
  var min = 60 * 1000;
  var ago = Date.now() - min;
  db.zrevrangebyscore('online', '+inf', ago, function(err, users){
    if (err) return next(err);
    req.online = users;
    next();
  });
});

app.get('/', function(req,res){
  res.send(req.online.length + ' users online');
});


app.listen(3000);

but after trying to launch it I get

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/home/USER/programming/nodejs/express1/node_modules/redis/index.js:148:24)
    at Socket.<anonymous> (/home/USER/programming/nodejs/express1/node_modules/redis/index.js:83:14)
    at Socket.EventEmitter.emit (events.js:96:17)
    at Socket._destroy.self.errorEmitted (net.js:329:14)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

I use node.js 0.8.18 and following packages:

app@0.0.1 /home/USER/programming/nodejs/express1
├─┬ express@3.1.0
│ ├── buffer-crc32@0.1.1
│ ├── commander@0.6.1
│ ├─┬ connect@2.7.2
│ │ ├── bytes@0.1.0
│ │ ├── formidable@1.0.11
│ │ ├── pause@0.0.1
│ │ └── qs@0.5.1
│ ├── cookie@0.0.5
│ ├── cookie-signature@0.0.1
│ ├── debug@0.7.2
│ ├── fresh@0.1.0
│ ├── methods@0.0.1
│ ├── mkdirp@0.3.3
│ ├── range-parser@0.0.4
│ └─┬ send@0.1.0
│   └── mime@1.2.6
└── redis@0.8.2
  • 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-18T14:02:47+00:00Added an answer on June 18, 2026 at 2:02 pm

    Check the port of reddis. If correct, give a wildcard to that port in any firewall which might block it. Check whether something else is using that port. Check your connection settings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing out the billing sample application provided by google: http://developer.android.com/guide/market/billing/index.html Everything is going
I wanted to try out an example you can find here: http://php.net/manual/en/function.include.php , but
I wanted to install pinax and other dependent packages listed at http://pypi.pinaxproject.com I try
I've just installed sequel gem for Ruby. I wanted to try example from Sequel
I am reading the price information from the http://aws.amazon.com/ec2/pricing/pricing-ebs-optimized-instances.json following is the code example
I wanted to try out this example of a self-hosted webservice (originally written in
I am using some code for a coverflow from the website, http://www.inter-fuser.com/2010/01/android-coverflow-widget.html this coverflow
So when I decided to parse content from a website. For example, http://allrecipes.com/Recipe/Slow-Cooker-Pork-Chops-II/Detail.aspx I
I found this link and I wanted to try the carousel example out. I
I just started out with Python and wanted to try out tornado. Running the

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.