add status API
This commit is contained in:
@@ -199,6 +199,11 @@ void setup(void) {
|
||||
file.close();
|
||||
server.send(200, "text/html", thePage);
|
||||
});
|
||||
server.on("/status", HTTP_GET, []() {
|
||||
server.sendHeader("Connection", "close");
|
||||
boolean isOpen=digitalRead(buttonPin)==HIGH;
|
||||
server.send(200, "application/json", "{ \"isOpen\": " + String(isOpen?"true":"false") + " }");
|
||||
});
|
||||
server.on("/serverIndex", HTTP_GET, []() {
|
||||
server.sendHeader("Connection", "close");
|
||||
server.send(200, "text/html", serverIndex);
|
||||
|
||||
Reference in New Issue
Block a user