API Reference ▸ Networking ▸ Handler
Represents a callback function called on the request.
Each handler must determine an uri, which is compared with the got request URI.
You should use
createHandler() to create a functional handler.
Access it with:
var Networking = require('networking'); var Handler = Networking.Handler;
- options — Object
Describes which type of the request, this handler can handle.
This property is compared with the request uri.
Used to determine whether the request uri is valid and can be handled by the handler callback.
Function used to handle the request.
It's called with three parameters: Networking.Request, Networking.Response and a next function.
If the next function is called, the next handler is checked.
- request — Networking.Request
- response — Networking.Response
- next — Function
Executes the handler, that is:
- compares the uri with the request,
- validates the request uri with the schema,
- calls the handler callback.
It's internally called by the
Returns a string describing the handler.