我有一个用C++编写的算法。不,我想创建一个前端web应用程序,通过它我可以获取输入,然后在后端执行我的c++程序。我怎样才能做到呢?
发布于 2022-11-16 22:45:12
我将使用像cpp-httplib这样的框架创建一个后端web应用程序。
例如,下面的端点/numbers在其url路径中接受数字
#include <httplib.h>
int main(void)
{
using namespace httplib;
Server svr;
svr.Get(R"(/numbers/(\d+))", [&](const Request &req, Response &res)
{
auto numbers = req.matches[1];
res.set_content(numbers, "text/plain");
});
svr.Get("/stop", [&](const Request &req, Response &res)
{ svr.stop(); });
svr.listen("localhost", 6000);
}https://stackoverflow.com/questions/70141812
复制相似问题