Version bump add dependency.
1 file changed
tree: df1df41f7d72d680f09d9b8e18e9244e5707b8d0
  1. accesscontrol/
  2. accumulate-request/
  3. accumulate-response/
  4. analytics/
  5. bin/
  6. config/
  7. eurekaclient/
  8. header-uppercase/
  9. healthcheck/
  10. json2xml/
  11. oauth/
  12. quota/
  13. quota-memory/
  14. spikearrest/
  15. test/
  16. test-helper/
  17. test-one/
  18. test-two/
  19. transform-uppercase/
  20. .gitignore
  21. .travis.yml
  22. index.js
  23. LICENSE
  24. package.json
  25. 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])