cgull is a multithreaded sever that has a subset of features from http 1.x.
- Containerisation using Docker
- Custom request routing inspired by node (found in
server_main.c
) e.g.
serve("./content");
route(GET, "/hello", text("Hello World!"));
route(GET, "/world", text("World!"));
- Custom logger with varying levels
debug, error, info
found inserver_logger.c
- Multithreaded using pthread
- Dynamically add web pages without reloading
- Supports GET and HEAD requests
The Makefile in src/Makefile
has several main commands
# Get in the right directory
cd src/
# Compile the server into a binary in src
make
# Delete any previously generated binaries, required for regenerating new binary
make clean
# Create the docker image, this compiles the C internally
make docker
# Run the docker container in the background
make docker-run-background
# Run the docker container with a shell
make docker-run
# Kill all running docker containers (useful if running in background)
make docker-kill
The C binary accepts one argument -- A port specified as the first command line argument
# Defaults to port 9001 (this is used by docker also)
./server
# Set the port manually
./server 8080
# Use a port that requires higher priveledges
sudo ./server 80