server.on -> loop

johnwasser:
Did you try this?

server.on("/blink", []() {

// the loop function runs over and over again forever
 loop();
});

void loop() {
   digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
   delay(1000);                       // wait for a second
   digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
   delay(1000);                       // wait for a second
 }

use an anonymous function to call unique function... why?

the problem in the code is (as Paul pointed out) is the issue with declaring a (very poorly named) function within the lambda. a looping construct can certainly be put into the lambda.

the OP may not literally want "the loop function runs over and over again forever" it looks like a cut and paste issue to me.