My Micro Gateway seems to be calling my plugin multiple times on startup and when requests come through. I added a console.log to the beginning of one of the sample plugins in the Apigee tutorials and its printing 8 times:
‘use strict’;
var debug = require(‘debug’)(‘plugin:response-override’);
console.log(“Before”);
module.exports.init = function(config, logger, stats) {
console.log(“after”);
return {
ondata_response: function(req, res, data, next) {
debug(‘***** plugin ondata_response’);
next(null, null);
},
onend_response: function(req, res, data, next) {
debug(‘***** plugin onend_response’);
next(null, “#Overwriting Response\n\n”);
}
};
}
This is what it prints when the gateway starts
Before
after
Before
after
Before
after
Before
after
Before
after
Before
after
Before
after
Before
after