【问题标题】:hapijs catbox-redis -- server returns to command prompthapijs catbox-redis -- 服务器返回命令提示符
【发布时间】:2015-02-05 06:34:35
【问题描述】:

问题:

从这个简单的“教程”样式代码中,当我启动服务器时,它会将server started on 8080 打印到控制台然后结束。没有提供额外的错误或输入。

(...代码后的更多调试信息...)

var hapi = require('hapi');

var server = new hapi.Server(8080, "localhost", {
    cache: {
        engine: require('catbox-redis'),
        options: {
            host: "10.99.99.99",  // fake ip
            partition: 'hello',   
            password: "soopersekret"  // not really, but you get the idea
        }
    } });

server.route({
    method: 'GET',
    path: '/',
    handler: function (request, reply) {
        reply('hello world');
    } });

server.start(function () { console.log('server started on 8080'); });

已尝试其他调试:

  1. 在开发系统上使用redis-cli,我们可以连接到主机并使用AUTH密码成功查看密钥,所以连接似乎正常。
  2. 在开发系统上运行本地redis实例,注释掉host,服务器启动并提供内容
  3. 注释掉整个 cache 配置部分会导致内容按预期提供

相信连接性和配置不是问题,而且对于如此简单得离谱的应用程序,并且没有来自应用程序的任何其他关于可能是什么问题的反馈,我们很难过。 :(

版本:节点 0.10.30;哈比 6.4.0;猫盒 3.1.0; catbox-redis 1.0.4

【问题讨论】:

  • 你试过删除分区吗?此外,我认为您可能还需要port,除非您的 redis 实例位于 6379 上。

标签: node.js hapijs


【解决方案1】:

检查是否在传递给 server.start 的回调中得到错误对象;

server.start(function (err) { 
  if (err) {
    return console.log(err); 
  }
  console.log('server started on 8080');
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-08
    • 1970-01-01
    • 2016-07-20
    • 1970-01-01
    • 2014-02-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多