Page 1 of 1

ESP8266 access point server

Posted: Sun Oct 31, 2021 11:38 am
by moetaz
Hello

can any one help me
how can run the css file and javascript file on the board esp8266

i building small webserver contain 3 html file and css file and javascript file

when i put the device in access point
the css file not loading or even the other html file or javascript

how i can create the link with micropython between the project pages

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 4:47 pm
by bitninja
Hello!

You will also need some sort of web server application to serve your page.

See here...

https://awesome-micropython.com/#web

HTH

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 5:22 pm
by moetaz
i had do the same idea but throw arduino

i just write below senetce to make the server see and collect all other html and css js file

server.serveStatic("/",SPIFFS, "/");

in micropython we don't have the same ????

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 6:26 pm
by bitninja
Even Arduino requires you to include some sort of web server.

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 6:35 pm
by moetaz
this wad my arduino code and the css file and js was working fine

server.serveStatic("/",SPIFFS, "/");

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html, processor);
});
server.on("/temperaturec", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", temperatureC.c_str());
});
server.on("/chart", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/chart.html");
});
server.on("/table", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/table.html");
});
// Start server
server.begin();

how can make it in micropython as all example on interent depending on simple webserver using function include html main code
in the main.py file

honestly i got tired i read alot alot

i hope to fine simple and easy solution

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 6:38 pm
by moetaz
and for sure in socket library that already exist in micropython
they have sort of code to can load the css file and make routing for the website pages

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 10:06 pm
by moetaz
thank you bitninja

i make it

Re: ESP8266 access point server

Posted: Sun Oct 31, 2021 11:56 pm
by moetaz
thank you i do it

but i face another problem
javascript not work well on the server
always receive error [Errno 110] ETIMEDOUT

any suggestion

i use java to draw chart from 3000 record stored in the esp8266

can you advice library can do chart and produce pdf file and work on esp8266