https://github.com/kamilgrocholski/ch
Building a simple HTTP server in c
https://github.com/kamilgrocholski/ch
c http-server
Last synced: 5 months ago
JSON representation
Building a simple HTTP server in c
- Host: GitHub
- URL: https://github.com/kamilgrocholski/ch
- Owner: KamilGrocholski
- Created: 2024-10-22T18:15:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-26T12:56:24.000Z (over 1 year ago)
- Last Synced: 2025-10-06T00:57:24.736Z (9 months ago)
- Topics: c, http-server
- Language: C
- Homepage:
- Size: 152 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTTP server
Building a simple HTTP server in C, inspired by modern web frameworks.
## Source tree
```plaintext
├── main.c # Entry file of the server
├── core # Core utils for memory management, strings, arrays, etc.
│ ├── arena.c
│ ├── arena.h
│ ├── array.c
│ ├── array.h # Dynamic arrays with metadata headers
│ ├── assert.h # Custom asserts
│ ├── defines.h # Common macro utilities and type definitions (e.g., u32, i32)
│ ├── hashmap.c
│ ├── hashmap.h
│ ├── logger.c
│ ├── logger.h # Logger used throughout the whole project
│ ├── memory.c
│ ├── memory.h # Memory management utilities
│ ├── str.c
│ ├── str.h # String view
│ ├── strhashmap.c
│ ├── strhashmap.h # Hashmap but for str_t only keys and values
│ ├── string.c
│ ├── string.h # C strings with metadata headers
├── fs # Filesystem utils
│ ├── fs.c
│ └── fs.h
├── env # Env utils for loading and parsing .env like files
│ ├── env.c
│ └── env.h
├── unicode
│ ├── unicode.c
│ └── unicode.h
└── net # Network utils
├── http
│ ├── cookie.c
│ ├── method.c
│ ├── middleware.c
│ ├── mime.c
│ ├── request.c
│ ├── response.c
│ ├── router.c
│ └── status.c
├── http.c
├── http.h # All in one HTTP header
├── url.c
└── url.h
```
## How to setup
- Create .env file based on .env.example
- Go to `src/main.c` and add routes
## To start
```bash
make && ./bin/main
```
## To run unit tests
```bash
make test
```