Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving pages from the filesystem #503

Open
renegadeandy opened this issue Feb 5, 2018 · 10 comments
Open

Serving pages from the filesystem #503

renegadeandy opened this issue Feb 5, 2018 · 10 comments
Labels
DEV Help Wanted Developer Needs Help

Comments

@renegadeandy
Copy link

renegadeandy commented Feb 5, 2018

Can somebody offer an example sketch which serves the in memory pages, from the filesystem instead of the ones in memory?

I have read and tried changing the server to a SPIFFS server(https://github.com/r-downing/SPIFFSReadServer) rather than a ESP8266WebServer, but the result is never stable. Please offer an example of how this can be done.

Using v2 prebuilt, 80mhz, esp-12-e, all through Arduino IDE

@tablatronix tablatronix added the DEV Help Wanted Developer Needs Help label Feb 6, 2018
@renegadeandy
Copy link
Author

Help? Is there a community around this library?

@tablatronix
Copy link
Collaborator

Nobody is gonna dl a zip to see your code

@renegadeandy
Copy link
Author

renegadeandy commented Feb 9, 2018

The code can be found here: https://bitbucket.org/renegadeandy/wifimanagerbug/

Assuming you had a data/otherpage.html, data/css/style.css, data/js/other.js, it should be served up.

But it rarely works and makes a real meal of serving the pages.

@tablatronix
Copy link
Collaborator

maybe remove the wifimanager handlenotfound event ?

@tablatronix
Copy link
Collaborator

oh nm you did

@renegadeandy
Copy link
Author

yep . :)

It's not that.

@renegadeandy
Copy link
Author

Bump.

@morrisho
Copy link

morrisho commented May 29, 2020

Hi there, I figured something out finally. I am able to use SPIFFS to load .html and .css files. I successfully did the root page and I am working on other pages too. However, I actually uses khoih's version for my mod. But the method is the same. This is the first time I contribute something on github so I am not sure how this works. Should I put my mod on a forked version or how does people normally do?

@tablatronix
Copy link
Collaborator

fork, new branch with name of change

@morrisho
Copy link

morrisho commented May 30, 2020

Hello, I put my mod here. I don't know much about html or css so I did my best I can moving the HTTP array stuff to html files. I am not sure how to do dynamic html content update so I basically dump the file text into string and replace {variables} with updated information. This is the reason the html file cannot have \n character otherwise the replace function won't work. I googled around found that it seems AJAX can be used for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV Help Wanted Developer Needs Help
Projects
None yet
Development

No branches or pull requests

3 participants