Submodule middleware.lua
is a part of GraphQL API module that provide three simple stub triggers that may be used in some simple non Tarantool Cartridge Applications to make module work from the box and also for any http-middlewaring tasks: metrics, auth, etc. In real non Tarantool Cartridge application these stubs must be replaced with any desired logic.
If GraphQL API Tarantool Cartridge Role is used than cartridge.auth
functions is used by default.
middleware.render_response(resp)
- trigger function that can be used to inject or filter or modify request response. Triggered after rendering each http response,
where:
resp
(table
) - http response table (for more info see: response object)
returns:
[1]
(table
) - http response table (for more info see: response object)
middleware.request_wrapper(resp)
- trigger function that can be used to wrap whole request. Ususally used to collect metrics,
where:
handler
(function
) - mandatory, http handler, for more info refer to route handlers
returns:
[1]
(table
) - http response table (for more info see: response object)
middleware.authorize_request(req)
- trigger function that can be used for custom request processing: logging or requests filtering,
where:
req
(table
) - http request table (for more info see: request object)
returns:
[1]
(boolean
) - true if authorize is successful, false - if not.