Skip to content

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

@chess-levin

Description

@chess-levin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions