#include <WiFi.h>
#include <WebServer.h>
 
/* Put your SSID & Password */
const char* ssid = "ESP32";  // Enter SSID here
const char* password = "12345678";  //Enter Password here
 
/* Put IP Address details */
IPAddress local_ip(192,168,1,1);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);
 
WebServer server(80);
 
void handleRoot() {
  String html = "<!DOCTYPE html>";
  html += "<html>\n";
  html += "<head>\n";
  html += "<title>Server ESP32</title>\n";
  html += "</head>\n";
  html += "<body>\n";
  html += "<h1>Hello world</h1>\n";
  html += "</body>\n";
  html += "</html>";
  server.send(200, "text/html", html);
}
 
void handle_NotFound(){
  server.send(404, "text/plain", "Not found");
}
 
void setup() {
  Serial.begin(115200);
 
  WiFi.softAP(ssid, password);
  WiFi.softAPConfig(local_ip, gateway, subnet);
  delay(100);
 
  server.on("/", handleRoot);
  server.onNotFound(handle_NotFound);
 
  server.begin();
  Serial.println("HTTP server started");
}
void loop() {
  server.handleClient();
}