本地机器编译client.cpp
client.cpp如下
#include <iostream>
#include "httplib.h"
#include "json.hpp"
#include <tuple>
using namespace std;
using namespace httplib;
using namespace nlohmann;
int main()
{
Client client("http://ubuntu机器ip:10000");
auto res = client.Get("/hello");
cout << res->status << endl;
cout << res->body << endl;
auto info = json::parse(res->body);
for (auto item:info.items())
{ cout << item.key() <<", "<< item.value() << endl; }
cout << "-----------\n";
tuple<string,float,string> data = info["score"];
cout << get<0>(data) << " | ";
cout << get<1>(data) << " | ";
cout << get<2>(data) << endl;
}