user54202: I'm trying to create a AsyncWebServer after enabling the SoftAP:
#include <Arduino.h>
#include <SPIFFS.h>
#include <WiFi.h>
#include <WiFiAP.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

WebApp webapp;

void setup() 
{
  Serial.begin(115200);
  SPIFFS.begin();

  File f = SPIFFS.open("/index.html");
  String s = f.readString();
  Serial.println(s);
  f.close();

  WiFi.softAP("ssid", NULL);
  WiFi.softAPsetHostname("ssid");
  Serial.println(WiFi.softAPIP());

  webapp.Begin();
}

void loop()
{
}

class WebApp
{
public:
    WebApp();
    void Begin();

private:
    AsyncWebServer _server;
};

#include "webapp.h"

WebApp::WebApp() : _server(80)
{
}

void WebApp::Begin()
{
  _server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request)
  {
    Serial.println("GET request");
    _server.serveStatic("/", SPIFFS, "/").setDefaultFile("/index.html");
  });

  _server.onNotFound([](AsyncWebServerRequest *request){
    request->send(404);
  });

  _server.begin();
  Serial.println("[WEB] HTTP server started");
}

The SoftAP brings up the network and I can connect to it (softAPgetStationNum() tells me that 1 client is connected). It answers to pings.
The index.html is stored into the flash (the contents is printed out correctly).
But when I try to open the root page (192.168.4.1) it prints out "GET request" but the browser request timeouts and nothing is received.
Am I missing anything in the code?

user54202: The usage of serveStatic() is wrong. It's not intended to be used inside a callback. Just place the call in the setup of the webserver, i.e.:
void WebApp::Begin()
{
  _server.serveStatic("/", SPIFFS, "/").setDefaultFile("/index.html");

  _server.onNotFound([](AsyncWebServerRequest *request)
  {
    request->send(404);
  });

  _server.begin();
  Serial.println("[WEB] HTTP server started");
}


user66283: I don't have enough rep to make a comment on your post, but is it possible that when you give the parameter for the function setDefaultFile() that the forward slash on /index.html is causing the path of the file to be //index.html instead of /index.html.
Because serveStatic is probably appending the filename of setDefaultFile() to the root directory of / (the third parameter of serveStatic()), you're probably getting an extra character you don't want in your filepath.
TL;DR you don't need the / in index.html for setDefaultFile().
See https://github.com/me-no-dev/ESPAsyncWebServer#serving-files-in-directory for the example.

54202: <p>I'm trying to create a <code>AsyncWebServer</code> after enabling the <code>SoftAP</code>:</p>
<pre><code>#include &lt;Arduino.h&gt;
#include &lt;SPIFFS.h&gt;
#include &lt;WiFi.h&gt;
#include &lt;WiFiAP.h&gt;
#include &lt;AsyncTCP.h&gt;
#include &lt;ESPAsyncWebServer.h&gt;

WebApp webapp;

void setup() 
{
  Serial.begin(115200);
  SPIFFS.begin();

  File f = SPIFFS.open(&quot;/index.html&quot;);
  String s = f.readString();
  Serial.println(s);
  f.close();

  WiFi.softAP(&quot;ssid&quot;, NULL);
  WiFi.softAPsetHostname(&quot;ssid&quot;);
  Serial.println(WiFi.softAPIP());

  webapp.Begin();
}

void loop()
{
}

class WebApp
{
public:
    WebApp();
    void Begin();

private:
    AsyncWebServer _server;
};

#include &quot;webapp.h&quot;

WebApp::WebApp() : _server(80)
{
}

void WebApp::Begin()
{
  _server.on(&quot;/&quot;, HTTP_GET, [this](AsyncWebServerRequest *request)
  {
    Serial.println(&quot;GET request&quot;);
    _server.serveStatic(&quot;/&quot;, SPIFFS, &quot;/&quot;).setDefaultFile(&quot;/index.html&quot;);
  });

  _server.onNotFound([](AsyncWebServerRequest *request){
    request-&gt;send(404);
  });

  _server.begin();
  Serial.println(&quot;[WEB] HTTP server started&quot;);
}
</code></pre>
<p>The <code>SoftAP</code> brings up the network and I can connect to it (<code>softAPgetStationNum()</code> tells me that 1 client is connected). It answers to pings.
The <code>index.html</code> is stored into the flash (the contents is printed out correctly).</p>
<p>But when I try to open the root page (192.168.4.1) it prints out &quot;GET request&quot; but the browser request timeouts and nothing is received.</p>
<p>Am I missing anything in the code?</p>
 54202: <p>The usage of <code>serveStatic()</code> is wrong. It's not intended to be used inside a callback. Just place the call in the setup of the webserver, i.e.:</p>
<pre><code>void WebApp::Begin()
{
  _server.serveStatic(&quot;/&quot;, SPIFFS, &quot;/&quot;).setDefaultFile(&quot;/index.html&quot;);

  _server.onNotFound([](AsyncWebServerRequest *request)
  {
    request-&gt;send(404);
  });

  _server.begin();
  Serial.println(&quot;[WEB] HTTP server started&quot;);
}
</code></pre>
 66283: <p>I don't have enough rep to make a comment on your post, but is it possible that when you give the parameter for the function <code>setDefaultFile()</code> that the forward slash on <code>/index.html</code> is causing the path of the file to be <code>//index.html</code> instead of <code>/index.html</code>.</p>
<p>Because serveStatic is probably appending the filename of <code>setDefaultFile()</code> to the root directory of <code>/</code> (the third parameter of <code>serveStatic()</code>), you're probably getting an extra character you don't want in your filepath.</p>
<p><strong>TL;DR</strong> you don't need the <code>/</code> in <code>index.html</code> for <code>setDefaultFile()</code>.</p>
<p>See <a href="https://github.com/me-no-dev/ESPAsyncWebServer#serving-files-in-directory" rel="nofollow noreferrer">https://github.com/me-no-dev/ESPAsyncWebServer#serving-files-in-directory</a> for the example.</p>
