This means that when hapi supports multiple instances of the same plugin mudskipper will work.
This also allows you to access Mudskipper directly, so that you can instantiate the module multiple times independently (not as a plugin) without hapi complaining.
example usage standalone in another hapi plugin:
var Mudskipper = require('mudskipper');
exports.register = function (plugin, options, next) {
plugin.loader(require);
var mudskipper = new Mudskipper({
makeRoutes: plugin.route.bind(plugin)
});
mudskipper.buildRoutes({
resources: {
users: {
index: function (request, reply) {
reply([{ name: 'plugin1' }]);
}
}
}
}, next);
};
I made this as straightforward a port as possible. It could probably be tidied up quite a bit, but didn't want to confuse the reorganisation so we can check we're happy with it before we clean it up.
example usage standalone in another hapi plugin:
I made this as straightforward a port as possible. It could probably be tidied up quite a bit, but didn't want to confuse the reorganisation so we can check we're happy with it before we clean it up.