initial commit

This commit is contained in:
wt committed 2024-05-21 22:16:49 +07:00
commit 987215cd86
5 files changed
+34587

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#include <iostream>
#include "libs/httplib.h"
#include "libs/json.hpp"
#include <fstream>
int main() {
httplib::Server srv;
srv.Get("/api/token", [](const httplib::Request& request, httplib::Response& response) {
response.set_content("{\"token\":\"qwerty\"}", "application/json");
});
srv.Get("/api/users", [](const httplib::Request& request, httplib::Response& response) {
std::ifstream usersfile("users.json");
nlohmann::json usersdata = nlohmann::json::parse(usersfile);
usersfile.close();
response.set_content(usersdata.dump(), "application/json");
});
srv.listen("localhost", 43243);
return 0;
}