1# Civetweb API Reference 2 3### `mg_set_request_handler( ctx, uri, handler, cbdata );` 4 5### Parameters 6 7| Parameter | Type | Description | 8| :--- | :--- | :--- | 9|**`ctx`**|`struct mg_context *`|The context where the handler must be active| 10|**`uri`**|`const char *`|The URI to hook the handler on| 11|**`handler`**|`mg_request_handler`|Callback function doing the heavy lifting| 12|**`cbdata`**|`void *`|Optional user supplied data| 13 14`int mg_request_handler( struct mg_connection *conn, void *cbdata );` 15 16### Return Value 17 18*none* 19 20### Description 21 22The function `mg_set_request_handler()` hooks a callback function on a URI. That callback function is called whenever a client requests the specific URI. The callback function receives the connection information and optional user supplied data as parameters and can serve information back to the client. When the callback function does not send any information back to the client, it should return **0** to signal Civetweb that the Civetweb core should handle the request. A return value between 1 and 999 is used to tell Civetweb that the request has been handled and no further processing is necessary. The returned code is stored as the status code in the access log, it is therefore recommended, although not mandatory to return a status code which matches the state of the request. 23 24### See Also 25 26* [`mg_set_auth_handler();`](mg_set_auth_handler.md) 27