Hapi回复文件

JAY*_*ter 3 hapijs

此代码在9.0.3版中不起作用:

server.route({
    method: 'GET',
    path: '/',
    handler: function() {
        file: 'templates/index.html'

    }
});
Run Code Online (Sandbox Code Playgroud)

错误:

de_modules/hapi/node_modules/hoek/lib/index.js:723
    throw new Error(msgs.join(' ') || 'Unknown error');
          ^
Error: Unknown handler: file
Run Code Online (Sandbox Code Playgroud)

在版本8中,它运行良好.

JAY*_*ter 5

我已经解决了这个问题.从上一版本开始,这种可能性被削减了.在我包含"惰性"模块并注册后,工作正常.