Fixed first run. Added simple logging

This commit is contained in:
2026-06-22 14:57:14 +03:00
parent 6ff7c8a6cb
commit 52b0d6642f
2 changed files with 12 additions and 2 deletions

View File

@@ -19,3 +19,6 @@ Use file named `devices.json` in working directory or supply your own via config
### HTTPlib
* From: https://github.com/yhirose/cpp-httplib
* Version: 0.47.0
# Info on API
* https://github.com/usetrmnl/trmnl-firmware

View File

@@ -64,8 +64,7 @@ int main(int argc, char **argv)
server = make_shared<httplib::Server>();
}
server->listen(host, port);
server->Get("/api/setup", [](const httplib::Request& req, httplib::Response& res)
server->Get("/api/setup/", [](const httplib::Request& req, httplib::Response& res)
{
cout << req.headers.size() << endl;
for (auto header : req.headers)
@@ -75,5 +74,13 @@ int main(int argc, char **argv)
res.status = 400;
});
server->Post("/api/log/", [](const httplib::Request& req, httplib::Response& res)
{
cout << req.body << endl;
res.status = 200;
});
server->listen(host, port);
return 0;
}