{"id":20549575,"url":"https://github.com/edenreich/http-component","last_synced_at":"2025-03-06T05:29:04.944Z","repository":{"id":105873456,"uuid":"208579441","full_name":"edenreich/http-component","owner":"edenreich","description":"An easy to use native component for interacting with the http layer written in C++","archived":false,"fork":false,"pushed_at":"2019-10-07T22:53:49.000Z","size":138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T16:42:58.804Z","etag":null,"topics":["cmake","cpp","cpp-component","cpp17","http","http-client","http-server","request-handler","response-parsing","unix-socket","winsock2"],"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/edenreich.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":"2019-09-15T10:48:22.000Z","updated_at":"2019-10-07T22:53:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e133da5b-d426-42fe-9b20-d2274e89eaf4","html_url":"https://github.com/edenreich/http-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fhttp-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fhttp-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fhttp-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fhttp-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edenreich","download_url":"https://codeload.github.com/edenreich/http-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242153890,"owners_count":20080574,"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":["cmake","cpp","cpp-component","cpp17","http","http-client","http-server","request-handler","response-parsing","unix-socket","winsock2"],"created_at":"2024-11-16T02:18:36.255Z","updated_at":"2025-03-06T05:29:04.936Z","avatar_url":"https://github.com/edenreich.png","language":"C++","readme":"\u003cp\u003e\n  \u003ca href=\"https://github.com/edenreich/http-component\"\u003e\u003cimg alt=\"GitHub Actions status\" src=\"https://github.com/edenreich/http-component/workflows/build/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# HTTP Component\n\nAn easy to use component for interacting with the http layer written in C++\n\n## Usage\n\n```cpp\n// main.cpp\n#include \u003chttp/server.h\u003e\n#include \u003chttp/response.h\u003e\n#include \u003chttp/message.h\u003e\n#include \u003chttp/interfaces/client_interface.h\u003e\n\n#include \u003csstream\u003e\n\nusing namespace Http;\n\n\nint main(int argc, char const *argv[])\n{\n    Server server;\n\n    server.bind(\"0.0.0.0\");\n\n    server.listen(8080);\n\n    server.onConnection([](Interfaces::ClientInterface * client) {\n        Interfaces::MessageInterface * requestMessage = client-\u003egetRequest()-\u003egetMessage();\n        std::stringstream responseMessage;\n\n        std::string json = R\"JSON(\n            [\n                {\n                    \"id\": 1,\n                    \"name\": \"Pizza\",\n                    \"description\": \"lorem ipsum\"\n                },\n                {\n                    \"id\": 2,\n                    \"name\": \"Cola\",\n                    \"description\": \"lorem ipsum\"\n                },\n                {\n                    \"id\": 3,\n                    \"name\": \"Hamburger\",\n                    \"description\": \"lorem ipsum\"\n                }\n            ]\n        )JSON\";\n\n        responseMessage \u003c\u003c \"HTTP/1.1 200 OK\\r\\n\";\n        responseMessage \u003c\u003c \"Content-Type: application/json\\r\\n\";\n        responseMessage \u003c\u003c \"Content-Length: \" \u003c\u003c json.length() \u003c\u003c \"\\r\\n\";\n        responseMessage \u003c\u003c \"Connection: close\\r\\n\";\n        responseMessage \u003c\u003c \"\\r\\n\";\n        responseMessage \u003c\u003c \"\\r\\n\";\n        responseMessage \u003c\u003c json;\n\n        return new Response(new Message(responseMessage));\n    });\n\n    return 0;\n}\n```\n\n## Target\n\nThis project targets Linux, Windows and macOS","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenreich%2Fhttp-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedenreich%2Fhttp-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenreich%2Fhttp-component/lists"}