https://github.com/remirobert/rocko
:dog: Small, and basic http server, written in full C :frog:
https://github.com/remirobert/rocko
c http http-server request response
Last synced: 7 months ago
JSON representation
:dog: Small, and basic http server, written in full C :frog:
- Host: GitHub
- URL: https://github.com/remirobert/rocko
- Owner: remirobert
- License: mit
- Created: 2016-04-29T10:26:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-11T13:19:37.000Z (over 9 years ago)
- Last Synced: 2025-05-01T06:37:03.434Z (9 months ago)
- Topics: c, http, http-server, request, response
- Language: C
- Homepage:
- Size: 43.9 KB
- Stars: 20
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


Small, and basic http server, written in full **C** 😾 🐕. With a 🍰 API, easy to use like a ⚽️.
Use the **kevent** for async socket. Available for **OSX**, or **Free BSD**.
⚠️ This project is under development ⭐️.
#Installation
Use CMake to generate a Makefile, and the compile the source.
```sh
cmake .
make
```
#How to use
```C
//Include the rocko public API
#include "rocko.h"
//Create a function which defines your route.
//Keep in mind the prototype has to be this one.
//You get the request informations in parameters with the body.
struct response welcome(struct request req) {
//Here you build your response.
//Following this schema :
//{response_code, body}
return (struct response){R_200, "Welcome !"};
}
int main(int argc, char **argv) {
//Initalise rocko server has to be call before everything
rocko_init();
//Add your routes here with your method, the request_uri, and your function
rocko_add_route("GET", "/welcome", welcome);
//Start and run the server with your port
rocko_start(8080);
return 0
}
```
###Todo 🦀💨
- A lot of tests
- Buffer cricular, for reading and write on the sockets
- Upload, download files
- Benchmark, with orther languages and frameworks