-->
Page 1 of 7

myWebServer for esp8266

PostPosted: Fri Feb 05, 2016 12:01 pm
by NailBuster
I'm using this library as an easy starting/base library for working on the esp8266... myWebServer will serve files from the SPIFFs on your device. (You should only use this on devices with available spiffs! (4MB on nodemcu for example)).

features:

It will try and connect to your AcessPoint, if not config/connect it will auto-start local AP like "myespxxxx". You just connect to that AP with your phone/tablet and it will display Wifi connect configuration. (Uses captive DNS so you can just go to browser and type setup.com or "anything".com). restart nodemcu after you've configured connection....

Afterwards once the device connects to your local router/internet. You go to it's local lan IP, or if your system supports mDNS you can type http://"device_name".local on your browser(device name is from setup from above).

"Virgin" configs will bring up an integrated HTML file browser. You can upload multiple files or drag files to top to allow your webserver to work...(index.html...etc). Copy the sample html files into server to test out some features...

supports OTA updating of ESP device via Wifi.

ntp time support with some methods to easily grab current date/time.

see sample htmls in folder for other features.... if you look at the couldgen.html file you'll see how by just using the html the form is saved into a json file. So you can add a new form field and it will automatically be saved/loaded in the json file...without changing the server, really flexible to get/set new settings.

this is still a WIP but I'll be updating as needed....I have other features I want to implement as well....

source for project : https://github.com/nailbuster/myWebServer

Also I created a version with Async webserver library: Different but more stable with many web requests.

The Async version is here: https://github.com/nailbuster/myWebServerAsync

Re: myWebServer for esp8266

PostPosted: Mon Feb 08, 2016 7:52 am
by Manti
I get the following,
All libs should be installed...

Code: Select all
sketch\myWebServer.cpp: In function 'bool isAdmin()':

sketch\myWebServer.cpp:196:14: error: 'class ESP8266WebServer' has no member named 'authenticate'

  if (!server.authenticate(ConfigUsername.c_str(), ConfigPassword.c_str()))

              ^

sketch\myWebServer.cpp:198:10: error: 'class ESP8266WebServer' has no member named 'requestAuthentication'

   server.requestAuthentication();

          ^

sketch\myWebServer.cpp: In member function 'void MyWebServerClass::begin()':

sketch\myWebServer.cpp:660:7: error: 'class ESP8266WiFiClass' has no member named 'setAutoReconnect'

  WiFi.setAutoReconnect(true);

Re: myWebServer for esp8266

PostPosted: Mon Feb 08, 2016 9:18 am
by martinayotte
Your Arduino ESP framework is maybe too old, this Basic Authentication code has been added on Nov 29,
https://github.com/esp8266/Arduino/comm ... af32d7ccf7

Re: myWebServer for esp8266

PostPosted: Mon Feb 08, 2016 7:00 pm
by NailBuster
Here's a sample of the spiffs HTML file browser embedded in the server...really useful (supports drag/drop multiple files...etc)

Image