You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: API.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -2712,7 +2712,7 @@ Registers a server validation module used to compile raw validation rules into v
2712
2712
2713
2713
-`validator` - the validation module (e.g. **joi**).
2714
2714
2715
-
Return value: none.
2715
+
Return value: The `server` object.
2716
2716
2717
2717
Note: the validator is only used when validation rules are not pre-compiled schemas. When a validation rules is a function or schema object, the rule is used as-is and the validator is not used. When setting a validator inside a plugin, the validator is only applied to routes set up by the plugin and plugins registered by it.
* The default HTTP status code when the payload is considered empty. Value can be 200 or 204. Note that a 200 status code is converted to a 204 only at the time of response transmission (the
* custom validation function is defined via schema or status then options can an arbitrary object that will be passed to this function as the second argument.
* Validation schemas for specific HTTP status codes. Responses (excluding errors) not matching the listed status codes are validated using the default schema.
448
444
* status is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.
* An options object passed to the joi rules or the custom validation methods. Used for setting global options such as stripUnknown or abortEarly (the complete list is available here).
* Validation rules for incoming request path parameters, after matching the path against the route, extracting any parameters, and storing them in request.params, where:
* Validation rules for incoming request URI query component (the key-value part of the URI between '?' and '#'). The query is parsed into its individual key-value pairs, decoded, and stored in
* * rules - route custom rules object. The object is passed to each rules processor registered with server.rules(). Cannot be used if route.options.rules is defined.
942
951
* For context [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverrouteroute)
* (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the server's router configuration. The path
947
956
* can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters. For context [See
* additional route options. The options value can be an object or a function that returns an object using the signature function(server) where server is the server the route is being added to
972
981
* and this is bound to the current realm's bind option.
* route custom rules object. The object is passed to each rules processor registered with server.rules(). Cannot be used if route.options.rules is defined.
* @default '0.0.0.0' (all available network interfaces).
31
33
* Sets the hostname or IP address the server will listen on. If not configured, defaults to host if present, otherwise to all available network interfaces. Set to '127.0.0.1' or 'localhost' to
0 commit comments