c++ wfrest网络框架

c++ wfrest网络框架

  • github地址:https://github.com/wfrest/wfrest
  • gitee地址:https://gitee.com/wfrest/wfrest

workflow框架

  • github:https://github.com/sogou/workflow
  • demo:https://blog.51cto.com/u_15175878/2739149

编译wfrest库

1
2
3
cd wfrest
make
sudo make install

编译workflow库

1
2
3
4
5
6
cd wfrest/workflow
mkdir build
cd build
cmake ..
make
sudo make install

使用wfrest库和workflow库

1
2
3
mkdir wfrest_demo
cp example/01_basic.cc
touch CMakeList.txt

编写CMakeList.txt

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cmake_minimum_required(VERSION 3.6)

set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "build type")

project(wfrest_demo LANGUAGES C CXX)

include_directories(
	/usr/local/include/workflow
	/usr/local/include/wfrest
)

link_directories(/usr/local/lib)
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -Wall -fPIC -pipe -std=gnu90")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++11 -fno-exceptions")

add_executable(01_basic 01_basic.cc)
target_link_libraries(01_basic wfrest workflow)

编译

1
2
3
4
mkdir build
cd build
cmake ..
make

测试脚本

1
2
3
4
curl 127.0.0.1:8888/hello
curl 127.0.0.1:8888/data
curl 127.0.0.1:8888/multi
curl 127.0.0.1:8888/post