Un servidor web C ++ 20 Echo que se ejecuta en Linux .
Si un usuario ingresa un nombre <user> y un mensaje <msg> , el servidor responderá con <user> said "<msg>" .
Establezca la ubicación en la carpeta del proyecto y ejecute:
docker image build . -t < image > <image> debe reemplazarse con un nombre de imagen Docker personalizado.
docker container run < image > ctest --test-dir .. -VV config.yaml es la configuración predeterminada. Se copiará a Docker durante el edificio.
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 : stdoutAquí hay dos formas de hacer que una nueva configuración sea efectiva.
config.yaml y cree una nueva imagen de Docker .build/bin/config.yaml . Consulte src/log/README.md para obtener más detalles si desea cambiar la configuración del registrador.
docker container run -p < container-port > : < host-port > < image > <container-port> debe ser igual a server.port en config.yaml . <host-port> puede ser cualquier puerto disponible de la máquina host. -p <container-port>:<host-port> se une <container-port> del contenedor a <host-port> de la máquina host.
Una vez que el servidor se ejecute, abra un navegador y acceda http://localhost:<host-port> en la máquina host para usarlo.
Puede ejecutar el siguiente comando y acceder http://localhost:10000 si está utilizando la configuración predeterminada.
docker container run -p 10000:10000 < image > Las pruebas unitarias funcionan con el marco Googletest , que consiste en pruebas públicas y privadas.
tests . El nombre de un archivo de prueba unitario termina con _test .
El estilo de comentarios de código sigue la especificación de Doxygen .
El diagrama de clases sigue la especificación de sirena .
.
├── 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
Distribuido bajo la licencia MIT . Vea LICENSE para más información.