Hello,
I would like to know which is the best example for start to program a web server?
Where is possible to find it?
Thanks in advance.
Best Regards,
Juan
Create a Web Server
Re: Create a Web Server
I'm using a libeshttpd fork for my projects https://github.com/chmorgan/libesphttpd
Also: the ESP-IDF has an http server component, example here https://github.com/espressif/esp-idf/tr ... ttp_server - I haven't used it yet but it looks pretty good.
Also: the ESP-IDF has an http server component, example here https://github.com/espressif/esp-idf/tr ... ttp_server - I haven't used it yet but it looks pretty good.
-
- Posts: 7
- Joined: Mon Jul 16, 2018 6:04 am
Re: Create a Web Server
Hello,
I am starting from the example of the http_server of ESP-IDF.
But I detect that when the server sends a response always put the:
Content-Type application/json
What can I do to remove it?
Best regards,
Juan
I am starting from the example of the http_server of ESP-IDF.
But I detect that when the server sends a response always put the:
Content-Type application/json
What can I do to remove it?
Best regards,
Juan
Re: Create a Web Server
From my esp32 web server:
Code: Select all
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
server.on("/update", HTTP_GET,
[](AsyncWebServerRequest *request){
Serial.println(">>>>>>>>>>update");
int paramsNr = request->params();
Serial.print(" Number of Parameters: ");
Serial.println(paramsNr);
for(int i=0;i<paramsNr;i++){
AsyncWebParameter* p = request->getParam(i);
Serial.print("Param name: ");
Serial.print(p->name());
Serial.print(" Param value: ");
Serial.println(p->value());
String name = p->name();
String value = p->value();
Serial.println(">>>>>>>>>>>>>>>" + name + "/" + value);
preferencesUpdate(name, value);
}
request->send(200, "text/html", createHTML());
}
);
server.begin();
Serial.println(" Started");
return true;
}
//============================================================================================
static String createHTML() {
String tempHTML;
tempHTML = (String) "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\
<html>\
<head width=100% align=center>\
<title width=100% align=center>ESP32 - Preferences</title>\
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Who is online
Users browsing this forum: No registered users and 61 guests