Class haproxy.Service

Service wraps the service configuration and HTTP router.

Functions

Service.new (config) Initialize a new API instance.
Service:dispatch (request) Dispatch a request to the router and return the response.
Service:mount (app, prefix) Mount an application.
Service:register_routes (routes, prefix) Register routes.
Service:serve (applet) Serve a request.


Functions

Service.new (config)
Initialize a new API instance.

Parameters:

  • config table application configuration
Service:dispatch (request)
Dispatch a request to the router and return the response.

Parameters:

  • request HTTP request

Returns:

    Response the API response
Service:mount (app, prefix)
Mount an application. Mounting an application adds its routes to the top-level router.

Parameters:

  • app application module
  • prefix optional string Prepend routes with this prefix.
Service:register_routes (routes, prefix)
Register routes.

Parameters:

  • routes table routes to register
  • prefix optional string prepend routes with given prefix

Usage:

    Service:register_routes({ ['/info'] = api_info }, '/api')
Service:serve (applet)
Serve a request.

Parameters:

  • applet HAProxy AppletHTTP instance
generated by LDoc 1.4.3 Last updated 2016-06-26 17:50:20