feat: static file server

this lets you host web apps out of
:9993/app/{app_name}
:9993/app/{other_app}

from $ZT_HOME/app/{app_name}
This commit is contained in:
travisladuke 2024-02-05 12:38:44 -08:00
parent 6be0e67a5c
commit b4eb39fb16
3 changed files with 124 additions and 5 deletions

View file

@ -876,6 +876,7 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
std::string memberListPath2 = "/unstable/controller/network/([0-9a-fA-F]{16})/member";
std::string memberPath = "/controller/network/([0-9a-fA-F]{16})/member/([0-9a-fA-F]{10})";
auto controllerGet = [&, setContent](const httplib::Request &req, httplib::Response &res) {
char tmp[4096];
const bool dbOk = _db.isReady();
@ -887,11 +888,11 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
(unsigned long long)OSUtils::now(),
dbOk ? "true" : "false");
if (!dbOk) {
res.status = 503;
}
if (!dbOk) {
res.status = 503;
}
setContent(req, res, tmp);
setContent(req, res, tmp);
};
s.Get(controllerPath, controllerGet);
sv6.Get(controllerPath, controllerGet);