HTTP Requests on Arduino Nano 33 IoT

Hey all,
I was curious if it was possible to receive HTTP requests on the Arduino Nano 33 IoT. To be more specific I would like the Arduino to serve as a node on my home network that other devices could send a JSON object to through HTTP POST. For a simple example I could send a JSON object to the arduino that will specify the desired state of an LED, the arduino will read this object and then set the LED to the desired status of on or off. I found examples of people doing this with a ESP8266(example code provided below). Is there a way to copy something like this for the Arduino board? Am I correct in assuming it would require the WiFiNINA library? Let me know if I am misunderstanding anything, I just want to make sure that something like this is feasible before purchasing the board.


#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
 
ESP8266WebServer server(80);
 
const char* ssid = "YourNetworkName";
const char* password =  "YourNetworkPassword";
 
void setup() {
 
    Serial.begin(115200);
    WiFi.begin(ssid, password);  //Connect to the WiFi network
 
    while (WiFi.status() != WL_CONNECTED) {  //Wait for connection
 
        delay(500);
        Serial.println("Waiting to connect...");
 
    }
 
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());  //Print the local IP
 
    server.on("/body", handleBody); //Associate the handler function to the path
 
    server.begin(); //Start the server
    Serial.println("Server listening");
 
}
 
void loop() {
 
    server.handleClient(); //Handling of incoming requests
 
}
 
void handleBody() { //Handler for the body path
 
      if (server.hasArg("plain")== false){ //Check if body received
 
            server.send(200, "text/plain", "Body not received");
            return;
 
      }
 
      String message = "Body received:\n";
             message += server.arg("plain");
             message += "\n";
 
      server.send(200, "text/plain", message);
      Serial.println(message);
}

If that is all you are doing, then buy a ESP8266 board and you are all set. Why purchase a Nano 33?

I was looking at the nano for the added GPIO pins. The esp8266 only has 2.

The NodeMCU ESP8266 has I think +10 GPIO pins and 1 ADC and a enough memory to run a HTTP server.

Thank you. Quick and easy.