A Minimal HTTP server in C.
- Outputs a JSON response on port 8080.
- Uses sockets (
sys/socket.h
,netinet/in.h
). - Sends the JSON response.
- Accepts HTML client connections in a loop.
- Returns (ok) --> HTTP 200 status code.
Environment:
- Install Chocolatey: choco install
- Install MinGW:
choco install mingw
- Add MinGW to PATH:
C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
Compile:
gcc webserver.c -o webserver -lws2_32
Run:
.\webserver.exe
Environment:
- Install GCC:
sudo apt update && sudo apt install build-essential
Compile:
gcc webserver.c -o webserver
Run:
./webserver
Environment:
- Install Homebrew: brew install
- Install GCC:
brew install gcc
Compile:
gcc webserver.c -o webserver
Run:
./webserver