mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-16 03:19:18 +00:00
better redis error handling
This commit is contained in:
@@ -2,15 +2,16 @@ var express = require('express');
|
||||
var app = express();
|
||||
var redis = require('redis');
|
||||
|
||||
var client = redis.createClient(6379, 'redis');
|
||||
client.on("error", function (err) {
|
||||
console.error("Redis error", err);
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.redirect('/index.html');
|
||||
});
|
||||
|
||||
app.get('/json', function (req, res) {
|
||||
var client = redis.createClient(6379, 'redis');
|
||||
client.on("error", function (err) {
|
||||
console.error("Error connecting to redis", err);
|
||||
});
|
||||
client.hlen('wallet', function (err, coins) {
|
||||
client.get('hashes', function (err, hashes) {
|
||||
var now = Date.now() / 1000;
|
||||
|
||||
Reference in New Issue
Block a user