提问人:Vana 提问时间:3/28/2019 更新时间:3/28/2019 访问量:1440
C++ Url 路由(以及可能的解析)
C++ Url Routing (and possible parsing)
问:
我用 Boost Beast 启动了一个 api 服务器。 我使用异步 http 服务器。 我的目标是做与Express.js相同的事情 现在我是这样路由的:
if(req.method() == http::verb::post)
{
if(req.target() == "/mypath")
{
//do stuff
}
else
if(req.method() == http::verb::get)
{
if(req.target() == "/another/path")
{
//do stuff
}
我想像这样路由:route.get("/mypath", callback) ;
但是如何做到这一点呢?
答: 暂无答案
下一个:基于系统交叉构建的板条箱
评论
void get(const std::string& resource, std::function<void(http::request_parser<http::empty_body>)> callback);