This repo contains a simple web server prototype that can only serve text files on 'GET' requests. Requests are received via epoll and socket and then distributed among a thread pool's threads. A couple of classes are also covered with Boost unit tests.
- Linux (tested on kernel 5.4.95, Manjaro 20.2.1)
- Boost library v. 1.75 installed in system
- Ext Boost DI (from GitHub, see Preparations)
- Cmake (tested with version 3.19.4)
-
While in the root dir, clone Boost Ext DI project to
libs
dir:git clone https://github.com/boost-ext/di.git libs/di
-
Fill
defintions.h
with suitable parameters:THREADS_COUNT
- integer. It might be suboptimal to use more threads, that there are CPU coresWEB_ROOT
- absolute path ending with '/'PORT_TO_LISTEN
-
Compile on all cores:
$ cmake --build cmake-build-debug --target preview -- -j $(nproc)
-
Run with the following command:
$ ./cmake-build-debug/preview
-
Compilation:
$ cmake --build cmake-build-debug --target preview_boost_tests -- -j $(nproc)
-
Running:
$ ./cmake-build-debug/boost_tests/preview_boost_tests