详情还请移步至个人博客
逗神大人的个人小站
示例代码 (C++11, cpp-netlib版本:0.12.0)
需要链接库文件 - target_link_libraries(app
- boost_system
- network-uri
- cppnetlib-server-parsers
- )
复制代码- #include <network/uri.hpp>
- #include <nlohmann/json.hpp>
- #include <sspdlog/sspdlog.h>
- #include <boost/network/protocol/http/server.hpp>
- namespace http = boost::network::http;
- using json = nlohmann::json;
- struct Controller;
- using SimpleHTTPServer = http::server<Controller>;
- struct Controller {
-
-
- void operator() (SimpleHTTPServer
复制代码 |