Pro:
Contra:
Would I do it? No. The overhead is very big and slow. It might be fast enough while you only have few visitors, but that solution will not scale, as it makes several requests out of a single one. In my opinion it is better to use an internal API. You can wire that API to the outside for client-requests (don't forget to add input sanitation), but also use it from inside the server directly.
SHPS (v4.4) example:
// Plugin.js
'use strict';
module.exports.foo = function() {
// do something!
// This function can be called from any other plugin from code!
}
module.exports.onRebuildSandbox = function(requestState, sb) {
// Wire this plugin into the sandbox, which is used for client-requests
sb.myPlugin = {
foo: module.exports.foo,
};
};
// Request Script (in sandbox)
'use strict';
// When a client calls this script from HTTP, the following code will be executed
myPlugin.foo();
// OtherPlugin.js
'use strict';
const libs = require('node-mod-load').libs;
module.exports.handleSomething = function(requestState) {
// do whatever...
// Call API from code, no HTTP request involved....
libs.plugin.callEvent(requestState, 'foo');
};