Skip to content

A mock of the GO http server written in the C language

Notifications You must be signed in to change notification settings

oduortoni/c-http-server

Repository files navigation

c-http-server

Usage

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 the src/ folder, containing the corresponding .o files.

To compile and run the project, simply use:

make

Port Issues

If the port is already in use, set a custom port by declaring the PORT environment variable:

export PORT=9000

The default port is 9000.

Documentation

Comprehensive documentation is available in the docs folder. The documentation includes:

See the docs README for more information.

Contribution

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.pyz

and run

python pre-commit-*.pyz install

from 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

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •