Enthernet Code
Enthernet Code
How to send HTML page from a Web Server asynchronously in ESP-IDF?
To be able to send HTML page upon request you should first create a http handler
esp_err_t html_get_handler(httpd_req_t *req) {
const char *html_content = "<html><body><h1>Hello, World!</h1></body></html>";
httpd_resp_set_type(req, "text/html");
httpd_resp_send(req, html_content, HTTPD_RESP_USE_STRLEN);
return ESP_OK;
}
esp_err_t html_get_handler(httpd_req_t *req) {
const char *html_content = "<html><body><h1>Hello, World!</h1></body></html>";
httpd_resp_set_type(req, "text/html");
httpd_resp_send(req, html_content, HTTPD_RESP_USE_STRLEN);
return ESP_OK;
}
11 replies