Fixed first run. Added simple logging
This commit is contained in:
@@ -19,3 +19,6 @@ Use file named `devices.json` in working directory or supply your own via config
|
|||||||
### HTTPlib
|
### HTTPlib
|
||||||
* From: https://github.com/yhirose/cpp-httplib
|
* From: https://github.com/yhirose/cpp-httplib
|
||||||
* Version: 0.47.0
|
* Version: 0.47.0
|
||||||
|
|
||||||
|
# Info on API
|
||||||
|
* https://github.com/usetrmnl/trmnl-firmware
|
||||||
|
|||||||
11
main.cpp
11
main.cpp
@@ -64,8 +64,7 @@ int main(int argc, char **argv)
|
|||||||
server = make_shared<httplib::Server>();
|
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;
|
cout << req.headers.size() << endl;
|
||||||
for (auto header : req.headers)
|
for (auto header : req.headers)
|
||||||
@@ -75,5 +74,13 @@ int main(int argc, char **argv)
|
|||||||
res.status = 400;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user