SoftAP + Station at the same time ESP8266

I want to run both the modes of ESP8266(softAP and STA) simultaneously. I used the following code.

#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>

IPAddress local_IP(192,168,4,2);
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

const char* softAPssid = "softAP";
const char* password = "";

const char* wifi = "";
const char* pass = "";



void setup()
{
  //WiFi.mode(WIFI_AP_STA);

  Serial.begin(9600);
  delay(100);

  Serial.println();
  Serial.println(WiFi.getMode());
  
  softap();
  delay(300);
  STA();
  
}

void loop()
{
 server.handleClient();
}

void softap()
{
    Serial.print("configuring SoftAP....");
    Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet)? "Ready" : "Failed");

    Serial.println();
    delay(10);

    Serial.print("setting softAP....");
    Serial.println(WiFi.softAP(softAPssid, password));
    delay(10);

    Serial.println(WiFi.softAPIP());
  //delay(500);
  
    server.on ("/", [] () {server.send(200, "text/plain", "hello world!");});
    server.begin();
}

void STA()
{
      WiFi.begin(wifi, pass);

    while(WiFi.status()!= WL_CONNECTED)
    {
      Serial.print(".");
      delay(500);
    }

      Serial.println();

      Serial.print(".....Connect to the WiFi and open the IP address given below.....");
      Serial.println("IP address:-");
      Serial.println(WiFi.localIP());

      server.on ("/", [] () {server.send(200, "text/plain", "HELLO THERE");});
      server.begin();
      
}

staion mode displays the same text as it is displayed in softAP mode that is “hello world!” but not the “HELLO THERE”.

What should I do?

You’re using the same server object for both the AP and STA. That can’t be right…

Regards,
Ray L.

I tried to create two server objects but the result were same. What should I do?