Add uptime route

This commit is contained in:
Tyler Perkins 2022-04-29 12:57:33 -04:00
parent 7b0e2763ff
commit 531c5a7a68
2 changed files with 14 additions and 2 deletions

View File

@ -26,7 +26,7 @@ Proc file responses
------------- -------------
* returns uptime and idle time * returns uptime and idle time
* Same as /proc/uptime * Same as /proc/uptime file
Sample response Sample response
@ -41,11 +41,17 @@ Sample response
------------------- -------------------
* returns infomration regarding system memory * returns infomration regarding system memory
* Same as /proc/meminfo * All responses are in kB
* Same as /proc/meminfo file
Special formatted responses Special formatted responses
=========================== ===========================
[GET] /uptime
-------------
* Returns a redirect to /proc/uptime
[GET] /load [GET] /load
---------- ----------

View File

@ -41,6 +41,12 @@ void setRoutes(crow::SimpleApp& app){
} }
}); });
CROW_ROUTE(app, "/uptime")([](){
crow::response ret;
ret.moved_perm("/proc/uptime");
return ret;
});
CROW_ROUTE(app, "/mem")([]{ CROW_ROUTE(app, "/mem")([]{
return "mem"; return "mem";
}); });