Namespace: Plugin

Plugin

Plugin module file description
Source:

Example

function myPlugin(config)
 {

    this.code = function(req, res)
    {
        req.continue = false; // stop the app loop for this request

        res.end('Hello, world !');
    }

    this.runOnce = function()
    {
      // do something here, it will be called only on 1 thread
    }

    // we forge a route
    wf.Router.GET('*', '/about', routeCallback);

    function routeCallback(req, res)
    {
      // do something here, it will be called when route match
    }
 }

Methods

(static) code(req, res)

method that is called at each request loop
Parameters:
Name Type Description
req object http request object
res object http response object
Source:

(static) runOnce()

method that is called only on one thread
Source: