Version bump to make masking a mainline release.
1 file changed
tree: 52026e663b2a35e6d2a2505101987d62864e2a26
  1. accumulate-request/
  2. accumulate-response/
  3. analytics/
  4. bin/
  5. config/
  6. header-uppercase/
  7. healthcheck/
  8. json2xml/
  9. oauth/
  10. quota/
  11. quota-memory/
  12. spikearrest/
  13. test/
  14. test-helper/
  15. test-one/
  16. test-two/
  17. transform-uppercase/
  18. .gitignore
  19. .travis.yml
  20. index.js
  21. LICENSE
  22. package.json
  23. README.md
README.md

#Plugins

Build Status Build Status

##Overview This repo contains plugins for the microgateway-core project.

These plugins can be loaded into the microgateway calling the load plugin method

##Building a plugin must contain an init method which returns an object literal with all of the handlers

{
  init:function(config,logger,stats){
    return {
    onrequest:function(req,res,[options],next){
    },
    ...
    }
  }
}

init method must return an object with handler methods for each event

the available handlers are

  • on_request
  • ondata_request
  • onend_request
  • on_response
  • ondata_response
  • onend_response
  • onclose_response
  • onerror_response

the handler signature will look like

function(sourceRequest,sourceResponse,[options],next){}
  • sourceRequest: the request from the northbound server

  • sourceResponse the response to the northbound server

  • options: are the full scope of fields you might need to operate on.

    	const options = {
        targetResponse: options.targetResponse,
        targetRequest: options.targetRequest,
        sourceRequest: options.sourceRequest,
        sourceResponse: options.sourceResponse,
        data: data
      };
    
  • you must call next with an error if you errored out like

next([err])