PicoWeb As Simple Content Server
Posted: Fri Aug 11, 2017 1:49 am
I've managed to build a custom firmware that has picoweb embedded as frozen modules. Then I added a simple server script that simply delivers content from a folder on the flash file system...
It works well for me... most of the time. Once the page being rendered contains a fair amount of graphics though, the ESP8266 falls behind and images are lost.
Anyway, it is quite exciting that we have tools like this to work with!
Code: Select all
import ure as re
import picoweb
ROUTES = [
("/", lambda req, resp: (yield from app.sendfile(resp, "/wwwroot/index.html"))),
(re.compile("^/(.+)"), lambda req, resp: (yield from app.sendfile(resp, "/wwwroot/" + req.url_match.group(1)))),
]
import logging
logging.basicConfig(level=logging.INFO)
app = picoweb.WebApp(None, ROUTES)
app.run(debug=True,host="0.0.0.0")
Anyway, it is quite exciting that we have tools like this to work with!