deckerego / ampule

A tiny HTTP server made for CircuitPython WiFi devices (like the ESP32)
MIT License
60 stars 10 forks source link

How to i set this to service files from a directory #29

Open theboyknowsclass opened 6 months ago

theboyknowsclass commented 6 months ago

is it possible to set it to serve plain html files from a '\static' directory say?

deckerego commented 6 months ago

You could - see https://github.com/deckerego/ampule/blob/main/examples/webserver/webpages.py as an example of how to retrieve files based on a GET request.

If you wanted to serve up a whole directory, you could create a handler from a base path (say static/) and then look at the request object to determine which file to serve.