プラグインごとにルートを実装したいのですが、プラグイン内にビュー エンジンを追加できません。これが可能な例を見てきました.EG: https://github.com/hapijs-edge/hapi-plugins.com/blob/master/lib/routes.jsですが、次のようなエラーが表示されますserver.views is not a function
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection();
var myPlugin = {
register: function (server, options, next) {
// Error happens here, should be able to see server.views()
console.log(server.views());
next();
}
};
myPlugin.register.attributes = {
name: 'myPlugin',
version: '1.0.0'
};
server.register( myPlugin, function(err) {
if (err) {
console.error('Failed to load a plugin:', err);
}
} );
server.start(function () {
console.log('Server running at:', server.info.uri);
});