Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By alonewolfx2
#17543
atrus wrote:I'm not trying to serve excessively large or complex pages, just trying to keep the stuff the webserver serves separate from the webserver itself.

did you look this sming project? it has very basic usage. flash firmware, upload web files(html,css..) with direct ftp like standart webservers :)
User avatar
By Stevenelson
#17566 To server different webpages you need multiple calls to the server.on() event. It'll look like this:

void setup(void)
{
server.on("/", handle_root);
server.on("/page1", handle_page1);
server.on("/page2", handle_page2);
}

Then each of those you make a function like this:

function handle_root(){

}
function handle_page1(){

}
function handle_page2(){

}


Inside those function you have to call the server.send() function. like this: server.send(200, "text/plain", "hello world"); You put those in each of the functions, that last string is the html for the page:

function handle_root(){
server.send(200, "text/plain", "I am the <b>root</b> page");
}
function handle_page1(){
server.send(200, "text/plain", "I am page <i>one</i>");

}
function handle_page2(){
server.send(200, "text/plain", "I am page <span style='color:red'>two</span>");

}


Finally... in the loop, you have to call the server.handleClient(); method. like this:

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

Look at the helloServer example. It has all this in it.
User avatar
By ficeto
#17602 in the next version of the Arduino IDE for esp8266 there is a nice web server example coming with SDCARD and SPIFFS support and even a single page browser/editor/uploader to manage the files on both/either storages. Most of the changes are already in GitHub, but the full example is missing still (well it's on my computer).
Basically undefined URLs are checked if exist on either storage and streamed back to the browser.
More HTTP methods are available, proper GET/POST parsing and handling (forms, uploads, you name it..)
And all through the Arduino IDE. Is that what you are looking for?