To compile the project, use the Makefile in the root directory. This will generate the following structure:
- The
bin/folder contains the compiled binary and a folder for object files (.o). - The
obj/folder mirrors thesrc/folder, containing the corresponding.ofiles.
To compile and run the project, simply use:
makeIf the port is already in use, set a custom port by declaring the PORT environment variable:
export PORT=9000The default port is 9000.
Comprehensive documentation is available in the docs folder. The documentation includes:
- Server Architecture - Layered architecture design and protocol separation
- Core Documentation - Beginner-friendly explanation of how the server works
- Visual Guide - Diagrams illustrating the server architecture
- Practical Examples - Code examples for extending the server
See the docs README for more information.
To ensure consistent code style, clang-format is used. To ensure you will not
forget to execute it, download latest
pre-commit-*.pyz
wget https://github.com/pre-commit/pre-commit/releases/download/v4.5.1/pre-commit-4.5.1.pyzand run
python pre-commit-*.pyz installfrom the project's root directory.
Now, each time you'll execute git commit pre-commit will launch
clang-format and only allow you to perform the commit if all files are
conformed, otherwise you'll have to add all files that were modified and
repeat.
If you are relying on clangd during development, you, probably, want to setup
compile_commands.json locally. Recommended way is using bear:
bear -- make -B BUILD_TYPE=debug bin/server bin/gtest