实战(干货)
话不多说,我们来一起看看,10行C++代码怎么实现一个高性能的Http服务,轻松QPS几十万。Linus说:talkischeap,showmethecode↓
intmain(){WFHttpServerserver([](WFHttpTask*task){task-gt;get_resp()-gt;append_output_body(HelloWorld!);});if(server.start()==0){getchar();//pressEntertoend.server.stop();}return0;}
这个server使用了workflow,安装编译都非常简单,以Linux为例,把代码拉下来后,一行命令即搞定编译:
gitclone