Function esp_idf_hal::sys::httpd_start
source ยท pub unsafe extern "C" fn httpd_start(
handle: *mut *mut c_void,
config: *const httpd_config,
) -> i32
Expand description
@brief Starts the web server
Create an instance of HTTP server and allocate memory/resources for it depending upon the specified configuration.
Example usage: @code{c}
//Function for starting the webserver httpd_handle_t start_webserver(void) { // Generate default configuration httpd_config_t config = HTTPD_DEFAULT_CONFIG();
// Empty handle to http_server
httpd_handle_t server = NULL;
// Start the httpd server
if (httpd_start(&server, &config) == ESP_OK) {
// Register URI handlers
httpd_register_uri_handler(server, &uri_get);
httpd_register_uri_handler(server, &uri_post);
}
// If server failed to start, handle will be NULL
return server;
}
@endcode
@param[in] config Configuration for new instance of the server @param[out] handle Handle to newly created instance of the server. NULL on error @return
- ESP_OK : Instance created successfully
- ESP_ERR_INVALID_ARG : Null argument(s)
- ESP_ERR_HTTPD_ALLOC_MEM : Failed to allocate memory for instance
- ESP_ERR_HTTPD_TASK : Failed to launch server task