Support for plugin.inject
Could we add also functionality to be able to inject another requests from the plugin? for now there exists a method server.inject which could be also used for: " invoking routing logic internally". This is possible to perform from the server, but not from the plugin. Only one workaround to achieve this is:
plugin.servers.forEach(function(server) {
server.inject('/test-path', function(res) {
reply(res.result);
});
});
but there must be just one instance of server (usning Hapi.createServer())
Not sure we can do this. The whole point of the pack is to abstract how many servers are inside of it. Which server should we inject into?
I was hoping that it could be the same server as the server.route is called? The method server.route (plugin.route) is also called for each server?
There is a big difference. How do you expect this function to collect/consolidate the responses? what if the endpoint was only added to a few of the servers?
Hmm I am not sure. If you think, that this could not be achieved, I agree with you. I just thought that if there is a plugin.route function, there could be a possibility to do also plugin.inject. Because in my example code- the foreach is really dangerous, and I also don't know how to identify correct server (in my case there should be just one- but I can not rely on that). Maybe the only one good approach here is to pass desired server to the plugin using the plugin options.
I don't see how this can work.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.