esp8266 / esp8266/Arduino

esp8266webserver question: How to run some own code before server.serveStatic();

Open
#8,536 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

How do I run some own code before `server.serveStatic();` ?

I have a html file stored in LittleFS and serve it via `httpServer.serveStatic("/action", LittleFS, "/action.html");`
Now I want to execute some code first when someone requests `/action` and then send `action.html` , but I can't find no other way than to write a handler function that executes my code and then reads the file into a `String fileBuffer` and finally sending the String via `httpServer.send(200, HTML, fileBuffer);`

Does anybody has a hint for a better way of doing this?

I'using latest version of esp8266webserver on an wemos d1 mini with 4MB.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.