Echo Web Server
1.0.0
在Linux上運行的C ++ 20 Echo Web服務器。
如果用戶輸入名稱<user>和消息<msg> ,則服務器將用<user> said "<msg>"回复。
將位置設置為項目文件夾並運行:
docker image build . -t < image > <image>應替換為自定義Docker圖像名稱。
docker container run < image > ctest --test-dir .. -VVconfig.yaml是默認配置。它將在建築物期間複製給Docker 。
server :
# The TCP listening port.
port : 10000
# The website folder.
asset_folder : " assets "
# The maximum alive time for client timers (in seconds).
# When a client's timer reaches zero and it has no activity, it will disconnect.
alive_time : 60
loggers :
- name : root
level : info
appenders :
- type : stdout這是使新配置有效的兩種方法。
config.yaml並構建一個新的Docker映像。build/bin/config.yaml 。如果要更改Logger配置,請參見src/log/README.md以獲取更多詳細信息。
docker container run -p < container-port > : < host-port > < image > <container-port>應等於config.yaml中的server.port 。 <host-port>可以是主機機器的任何可用端口。 -p <container-port>:<host-port>綁定容器的<container-port>到主機機器的<host-port> 。
服務器運行後,打開瀏覽器並訪問http://localhost:<host-port>在主機計算機上使用它。
如果您使用默認配置,則可以運行以下命令並訪問http://localhost:10000 。
docker container run -p 10000:10000 < image > 使用Googletest框架,由公共和私人測試組成。
tests文件夾中。單元測試文件的名稱以_test結尾。
代碼註釋樣式遵循Doxygen規範。
班級圖遵循美人魚規範。
.
├── CITATION.cff
├── CMakeLists.txt
├── Dockerfile
├── LICENSE
├── README.md
├── .github
│ └── workflows
│ └── cmake-googletest.yaml
├── assets
│ ├── favicon.ico
│ ├── http-status.html
│ └── index.html
├── config.yaml
├── docs
│ └── badges
│ ├── C++.svg
│ ├── License-MIT.svg
│ ├── Linux.svg
│ ├── Made-with-CMake.svg
│ ├── Made-with-GitHub-Actions.svg
│ └── Made-with-Docker.svg
├── include
│ ├── config.h
│ ├── containers
│ │ ├── block_deque.h
│ │ ├── buffer.h
│ │ ├── epoller.h
│ │ ├── heap_timer.h
│ │ └── thread_pool.h
│ ├── http.h
│ ├── io.h
│ ├── ip.h
│ ├── log.h
│ ├── test_util.h
│ ├── util.h
│ └── web_server.h
├── src
│ ├── CMakeLists.txt
│ ├── config
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── config.cpp
│ ├── containers
│ │ ├── CMakeLists.txt
│ │ ├── buffer
│ │ │ ├── CMakeLists.txt
│ │ │ ├── README.md
│ │ │ └── buffer.cpp
│ │ ├── epoller
│ │ │ ├── CMakeLists.txt
│ │ │ └── epoller.cpp
│ │ └── thread_pool
│ │ ├── CMakeLists.txt
│ │ └── thread_pool.cpp
│ ├── http
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ ├── http.cpp
│ │ ├── request.cpp
│ │ ├── request.h
│ │ ├── request_test.cpp
│ │ ├── response.cpp
│ │ ├── response.h
│ │ └── response_test.cpp
│ ├── io
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── io.cpp
│ ├── ip
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── ip.cpp
│ ├── log
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ ├── appender.cpp
│ │ ├── config_init.cpp
│ │ ├── config_init.h
│ │ ├── config_init_test.cpp
│ │ ├── field.cpp
│ │ ├── field.h
│ │ ├── field_test.cpp
│ │ └── log.cpp
│ ├── main.cpp
│ ├── test_util
│ │ ├── CMakeLists.txt
│ │ └── test_util.cpp
│ └── util
│ ├── CMakeLists.txt
│ └── util.cpp
└── tests
├── CMakeLists.txt
├── config_test.cpp
├── containers
│ ├── block_deque_test.cpp
│ ├── buffer_test.cpp
│ ├── heap_timer_test.cpp
│ └── thread_pool_test.cpp
├── http_test.cpp
├── io_test.cpp
├── ip_test.cpp
├── log_test.cpp
└── util_test.cpp
根據MIT許可分發。有關更多信息,請參見LICENSE 。