@@ -21,8 +21,6 @@ It features
21
21
* Only files in the root folder are supported for simplicity - no directories.
22
22
23
23
24
-
25
-
26
24
## Implementing a web server
27
25
28
26
The ESP8266WebServer library offers a simple path to implement a web server on a ESP8266 board.
@@ -90,7 +88,7 @@ that actually has only one line of functionality by sending a string as result t
90
88
> });
91
89
> ```
92
90
93
- Here the text from a static String with html code is returned instead of a file from the filesystem.
91
+ Here the text from a static string with html code is returned instead of a file from the filesystem.
94
92
The content of this string can be found in the file `builtinfiles.h`. It contains a small html+javascript implementation
95
93
that allows uploading new files into the empty filesystem.
96
94
@@ -100,14 +98,14 @@ Just open <http://webserver/$upload.htm> and drag some files from the data folde
100
98
## Registering a function to handle requests to the server without a path
101
99
102
100
Often servers are addressed by using the base URL like <http://webserver/> where no further path details is given.
103
- Of course we like the user to be redirected to something usable. Therefore the `handleRoot ()` function is registered:
101
+ Of course we like the user to be redirected to something usable. Therefore the `handleRedirect ()` function is registered:
104
102
105
103
> ```CPP
106
- > server.on("/$upload.htm ", handleRoot );
104
+ > server.on("/", HTTP_GET, handleRedirect );
107
105
> ```
108
106
109
- The `handleRoot ()` function checks the filesystem for the file named **/index.htm** and creates a redirect to this file when the file exists.
110
- Otherwise the redirection goes to the built-in **/$upload.htm** web page.
107
+ The `handleRedirect ()` function checks the filesystem for the file named **/index.htm** and creates a redirect
108
+ response to this file when the file exists. Otherwise the redirection goes to the built-in **/$upload.htm** web page.
111
109
112
110
113
111
0 commit comments