We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/wfrest/wfrest
#include "wfrest/HttpServer.h" using namespace wfrest; int main() { HttpServer svr; // curl -v http://ip:port/hello svr.GET("/hello", [](const HttpReq *req, HttpResp *resp) { resp->String("world\n"); }); // curl -v http://ip:port/data svr.GET("/data", [](const HttpReq *req, HttpResp *resp) { std::string str = "Hello world"; resp->String(std::move(str)); }); // curl -v http://ip:port/post -d 'post hello world' svr.POST("/post", [](const HttpReq *req, HttpResp *resp) { // reference, no copy here std::string& body = req->body(); fprintf(stderr, "post data : %s\n", body.c_str()); }); if (svr.start(8888) == 0) { getchar(); svr.stop(); } else { fprintf(stderr, "Cannot start server"); exit(1); } return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
项目地址
https://github.com/wfrest/wfrest
项目描述
示例代码:
The text was updated successfully, but these errors were encountered: