NNG_HTTP_HANDLER_SET_TREE(3http)
β¨ NAME β¨
nng_http_handler_set_tree β set HTTP handler to match trees. Welcome to the NNG Reference Manual, bestie; this is the NNG_HTTP_HANDLER_SET_TREE(3http) page, and yes weβre getting into tree-matching handler lore. π
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_handler_set_tree(nng_http_handler *handler);
int nng_http_handler_set_tree_exclusive(nng_http_handler *handler);
π¦ DESCRIPTION π¦
Okay so nng_http_handler_set_tree() makes the handler match when the request URI sent by the client is a logical child of the path for handler, and no more specific handler has been registered. Thatβs the whole vibe. β¨
nng_http_handler_set_tree_exclusive() is similar to nng_http_server_set_tree() β yes, thatβs the exact name in this manual page, bestie β with the distinction that the handler will be considered to exclusively handle its request URI. Unlike nng_http_server_set_tree(), it will not be possible to register additional handlers in logical subdirectories of handler. Periodt. π
This is useful in cases when the handler would like to examine the entire path and possibly behave differently; for example a REST API that uses the rest of the path to pass additional parameters. Iconic. π
Tip: These methods are useful when constructing API handlers where a single service address (path) supports dynamically generated children. π«Ά
Tip: The non-exclusive form is also useful for providing a default handler to be generated when a more specific child does not exist. This can provide a better experience for users than the standard 404 error handling. π
π RETURN VALUES π
This function returns 0 on success, and non-zero otherwise. Slay. β¨
π ERRORS π
NNG_ENOMEMβ Insufficient free memory exists. πNNG_ENOTSUPβ No support for HTTP in the library. π
π SEE ALSO π
nng_http_handler_alloc(3http)nng_http_server_add_handler(3http)nng_http_req_get_method(3http)nng(7)
Thatβs the tea, bestie π this page is from the NNG Reference Manual, dated 2026-01-13, with the footer vibe NNG_HTTP_...R_SET_TREE(3http). Go off. π
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms