Skip to content

Commit

Permalink
Added root redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobalation committed Mar 26, 2020
1 parent 5949a29 commit 0e9aec1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Node main module/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ void handle_getSensorJSON()
server.send(200, "application/json", currentJSONReply);
}

// handle redirect to home
void handle_redirect()
{
// redirect back to main page
server.sendHeader("Location", "/_ac", true);
server.send(302, "text/plain", "");
}

// handle 404
void handle_NotFound()
{
Expand Down Expand Up @@ -497,6 +505,7 @@ void setup()
loadSettings();

// attach handlers for HTTPserver
server.on("/", handle_redirect);
server.on("/save_settings", handle_SaveSettings);
server.on("/getJSON", handle_getSensorJSON);

Expand Down

0 comments on commit 0e9aec1

Please sign in to comment.