Developed with
This is a simple http server written in C.
It is a recreational project, the main idea is to learn more about the http protocol.
Futhermore, this lib was made to be as lightweight and easy to use, like NodeJS Express or Python Flask.
- Can receive requests with methods:
- GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD
- Implemented 404 for resource not found
- Implemented 405 for method not allowed
- Implemented parameters resources:
/hello/<:id>
(check the examples) - Multithreading
└── C-HTTP-Server/
├── Makefile
├── README.md
├── examples
│ └── hello-world
│ ├── hello_world.c
│ └── include
│ ├── cJSON.c
│ └── cJSON.h
├── include
│ └── server.h
└── src
└── server.c
File | Summary |
---|---|
server.h | header file include/server.h |
File | Summary |
---|---|
server.c | source code implementation src/server.c |
Because the entire library is only one C file and one header file, you can just copy server.h
and server.c
to your projects source and start using it.
To execute tests, run:
/* TODO */
-
► Single thread server
-
► Multi thread
-
► Multiple Params resources
-
► Query Params
-
► Tests with Unity Lib
Contributions are welcome!
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a Git client.
git clone https://github.com/fillipehmeireles/C-HTTP-Server
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
Once your PR is reviewed and approved, it will be merged into the main branch.
This project is under the MIT License.
- In the Examples, it's being used the cJSON lib as parser. This is a very interesting lib, please check out.