Thursday 15 April 2010

Access plugins globally hapijs -



Access plugins globally hapijs -

is there way access plugins registered globally? i've read hapi-sequelize , want implement hapi application. here documentation. states there can access globally using code:

var db = plugin.plugins['hapi-sequelized'].models; db.test.create({ email: 'some@email.com', password: 'alskfjdfoa' });

i've tried insterting controllers not seem recognize plugin variable.

you can access plugin in handler:

handler: function (request, reply) { var db = request.server.plugins['hapi-sequelized'].models; (...) }

plugins hapijs

No comments:

Post a Comment