#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#define WIFI_SSID "Wokwi-GUEST"
#define WIFI_PASSWORD ""
WebServer myserver(80);
void setup(void) {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED);
Serial.print("IP");
myserver.on("/", handle_connect);
myserver.on("/hello", handle_hello);
myserver.begin();
}
void loop(void) {
myserver.handleClient();
}
String html="<p>ESp32 WebServer</p><p>STA-Mode</p><p>Lop 20CT114</p>";
void handle_connect(){
Serial.println("HTTP Request");
myserver.send(200, "text/html",html);
}
void handle_hello(){
Serial.println("HTTP Request");
myserver.send(200, "text/plain", "hellooooo");
}