webCode/Cpp/testHTTP/MyHttp/main.cpp
2023-10-14 15:48:44 +08:00

28 lines
612 B
C++

/*
g++ -o main main.cpp -std=c++11 -lwfrest -lworkflow -lz -Wl,-rpath=/usr/local/lib
*/
#include "wfrest/HttpServer.h"
#include <cstdio>
#include <iostream>
#include <string>
#include <wfrest/HttpContent.h>
#include <wfrest/HttpMsg.h>
#include <workflow/URIParser.h>
#include "ztool.hpp"
using namespace wfrest;
int main(){
HttpServer sv;
sv.GET("/",[](const HttpReq *req,HttpResp *resp)->void{
resp->String("Hello "+ +" !");
});
if (sv.start(8888)==0) {
getchar();
sv.stop();
}else {
fprintf(stderr,"Cannot open port 8888 and start the server!!");
}
}