user67648: I want to specify a function with parameters for a function parameter, but it doesn't come together.
////////////////////////////////////////////////////////////////////////

// Example funch...
void fileLoad(String path, String type) {
  file = SD.open(path.c_str(), FILE_READ);
  server.streamFile(file, type) != file.size();
  file.close();
}

// This is how I want to use it, but it's not possible:
server.on("/homepage", fileLoad("app/homepage.html", "text/html") );

////////////////////////////////////////////////////////////////////////

// Currently, as it works, you need 1 extra funch...:
void homepage() {
  fileLoad("app/homepage.html", "text/html");
}
server.on("/homepage", homepage);



user70020: You can find examples of this sort of thing in the library's examples.
The on() function does support std::function as a parameter, which in turn, means you can use a C++11-onwards lambda expression (which Dave Newton mentioned in comments) to proxy your two-argument function call through a no-argument function:
server.on("/homepage", [] () {
    fileLoad("app/homepage.html", "text/html");
});

The [] ("capture list") is something that would be used if you wanted to copy or refer to things within the scope of the on function call.  Since you're not doing that you could also just write a no-argument function which turns around and calls fileLoad with your two compile-time-known values.  But it is common for people using this webserver library to need to make references things in scope.

As as side note, I'd consider not using String as your received parameter type in void fileLoad(String path, String type).  When passing in a string literal, you're just causing dynamic allocation for no particularly good reason.

67648: <p>I want to specify a function with parameters for a function parameter, but it doesn't come together.</p>
<pre><code>////////////////////////////////////////////////////////////////////////

// Example funch...
void fileLoad(String path, String type) {
  file = SD.open(path.c_str(), FILE_READ);
  server.streamFile(file, type) != file.size();
  file.close();
}

// This is how I want to use it, but it's not possible:
server.on(&quot;/homepage&quot;, fileLoad(&quot;app/homepage.html&quot;, &quot;text/html&quot;) );

////////////////////////////////////////////////////////////////////////

// Currently, as it works, you need 1 extra funch...:
void homepage() {
  fileLoad(&quot;app/homepage.html&quot;, &quot;text/html&quot;);
}
server.on(&quot;/homepage&quot;, homepage);

</code></pre>
 70020: <p>You can find <a href="https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/PathArgServer/PathArgServer.ino" rel="nofollow noreferrer">examples of this sort of thing</a> in the library's examples.</p>
<p>The <code>on()</code> function <a href="https://github.com/esp8266/Arduino/blob/2.7.4/libraries/ESP8266WebServer/src/ESP8266WebServer.h#L94" rel="nofollow noreferrer">does support</a> <a href="https://en.cppreference.com/w/cpp/utility/functional/function" rel="nofollow noreferrer">std::function</a> as a parameter, which in turn, means you can use a C++11-onwards <a href="https://en.cppreference.com/w/cpp/language/lambda" rel="nofollow noreferrer">lambda expression</a> (which <a href="https://arduino.stackexchange.com/users/8583/dave-newton">Dave Newton</a> mentioned in comments) to proxy your two-argument function call through a no-argument function:</p>
<pre class="lang-cpp prettyprint-override"><code>server.on(&quot;/homepage&quot;, [] () {
    fileLoad(&quot;app/homepage.html&quot;, &quot;text/html&quot;);
});
</code></pre>
<p>The [] (&quot;capture list&quot;) is something that would be used if you wanted to copy or refer to things within the scope of the <code>on</code> function call.  Since you're not doing that you could also just write a no-argument function which turns around and calls <code>fileLoad</code> with your two compile-time-known values.  But it is common for people using this webserver library to need to make references things in scope.</p>
<hr />
<p>As as side note, I'd consider <em>not</em> using <code>String</code> as your received parameter type in <code>void fileLoad(String path, String type)</code>.  When passing in a string literal, you're just causing dynamic allocation for no particularly good reason.</p>
