{"id":22030887,"url":"https://github.com/farhaanaliii/cerver","last_synced_at":"2025-10-06T11:37:42.168Z","repository":{"id":250326013,"uuid":"834137533","full_name":"farhaanaliii/cerver","owner":"farhaanaliii","description":"Cerver is a lightweight HTTP server implemented in C.","archived":false,"fork":false,"pushed_at":"2024-11-18T10:37:52.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T10:01:32.639Z","etag":null,"topics":["c","c-programming","c-server","sockets","web-server"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farhaanaliii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T13:53:32.000Z","updated_at":"2024-11-18T10:37:55.000Z","dependencies_parsed_at":"2024-07-26T15:45:15.078Z","dependency_job_id":"c3d97d70-baae-4179-ac02-53fc639b0663","html_url":"https://github.com/farhaanaliii/cerver","commit_stats":null,"previous_names":["farhanaliofficial/cerver","farhaanaliii/cerver"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhaanaliii%2Fcerver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhaanaliii%2Fcerver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhaanaliii%2Fcerver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhaanaliii%2Fcerver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farhaanaliii","download_url":"https://codeload.github.com/farhaanaliii/cerver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252874210,"owners_count":21817781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c-programming","c-server","sockets","web-server"],"created_at":"2024-11-30T08:12:01.070Z","updated_at":"2025-10-06T11:37:42.082Z","avatar_url":"https://github.com/farhaanaliii.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cerver\n\nCerver is a lightweight and straightforward HTTP server library written in C, designed to be easy to use and integrate into your projects. Created by Farhan Ali ([@farhaanaliii](https://github.com/farhaanaliii)), this library allows you to quickly set up a server, define routes, and serve static files with minimal setup. Whether you're building a small personal project or a larger application, Cerver provides the essential tools needed to handle HTTP requests efficiently.\n\n![GitHub stars](https://img.shields.io/github/stars/farhaanaliii/cerver.svg)\n![GitHub forks](https://img.shields.io/github/forks/farhaanaliii/cerver.svg)\n![GitHub issues](https://img.shields.io/github/issues/farhaanaliii/cerver.svg)\n![GitHub release](https://img.shields.io/github/release/farhaanaliii/cerver.svg)\n\n## Features\n\n- Simple and easy to use\n- Supports adding multiple routes\n- Serves static files\n- Logs HTTP requests\n\n## Installation\n\nTo use `cerver`, clone the repository and include the `server.h` and `server.c` files in your project.\n\n```bash\ngit clone https://github.com/farhaanaliii/cerver.git\n```\n\n## Usage\n\n### Example\n\n```c\n#include \"server.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n    Server server;\n    init_server(\u0026server, 3000);\n\n    add_route(\"/\", \"web/index.html\");\n    add_route(\"/about\", \"web/about.html\");\n    add_route(\"/contact\", \"web/contact.html\");\n\n    start_server(\u0026server);\n\n    return 0;\n}\n```\n\n## API\n\n### Structs\n\n#### `Server`\n\n```c\ntypedef struct {\n    int port;\n    int server_fd;\n    int addrlen;\n    struct sockaddr_in address;\n} Server;\n\n```\n\n#### `Route`\n\n```c\ntypedef struct {\n    char *route;\n    char *file_path;\n} Route;\n```\n\n### Functions\n\n#### `void init_server(Server *server, int port);`\n\nInitializes the server with the specified port.\n\n- `server`: A pointer to the `Server` structure.\n- `port`: The port number to listen on.\n\n#### `void add_route(char *route, char *file_path);`\n\nAdds a new route to the server.\n\n- `route`: The URL path for the route.\n- `file_path`: The file path to serve when the route is accessed.\n\n#### `void start_server(Server *server);`\n\nStarts the server and listens for incoming connections.\n\n- `server`: A pointer to the `Server` structure.\n\n## Contributing\n\nFeel free to submit issues and pull requests! Contributions are welcome.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhaanaliii%2Fcerver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarhaanaliii%2Fcerver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhaanaliii%2Fcerver/lists"}