{"id":35067609,"url":"https://github.com/stevepan643/cweb","last_synced_at":"2026-05-21T00:02:36.575Z","repository":{"id":328974411,"uuid":"1115660896","full_name":"stevepan643/cweb","owner":"stevepan643","description":"CWeb – A lightweight, learning-friendly C web framework with simple routing and HTTP support.","archived":false,"fork":false,"pushed_at":"2025-12-27T15:27:41.000Z","size":53,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-29T11:49:00.760Z","etag":null,"topics":["c","framework","help-wanted","http","http-server","lightweight","web"],"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/stevepan643.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-13T09:43:59.000Z","updated_at":"2025-12-15T05:04:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stevepan643/cweb","commit_stats":null,"previous_names":["stevepan643/cweb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stevepan643/cweb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevepan643%2Fcweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevepan643%2Fcweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevepan643%2Fcweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevepan643%2Fcweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevepan643","download_url":"https://codeload.github.com/stevepan643/cweb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevepan643%2Fcweb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33281310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-20T15:12:43.734Z","status":"ssl_error","status_checked_at":"2026-05-20T15:12:42.300Z","response_time":356,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","framework","help-wanted","http","http-server","lightweight","web"],"created_at":"2025-12-27T11:38:30.196Z","updated_at":"2026-05-21T00:02:36.552Z","avatar_url":"https://github.com/stevepan643.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CWeb - A Lightweight C Web Framework\n\nCWeb 是一個輕量級的跨平臺的 C 語言 Web 框架，旨在提供簡單、直觀、可擴展的 HTTP 服務能力，方便學習與實驗。\n\nCWeb is a lightweight C web framework designed to provide simple, intuitive, and extensible HTTP server functionality, \nsuitable for learning and experimental projects.\n\n## 功能 Features\n\n### 已實現 ✅\n\n- 支持基本 HTTP 方法：GET / POST / PUT / DELETE\n- 返回靜態 HTML 文件、JSON 和純文本響應\n- 簡單路由系統，支持不同接口函數綁定\n- TCP 網絡封裝，跨平台接口初步設計\n- 日誌系統，支持請求、響應與錯誤記錄\n- 多線程優化，提高並發處理能力\n\n### Implemented ✅\n\n- Supports basic HTTP methods: GET / POST / PUT / DELETE\n- Serve static HTML files, JSON and plain text responses\n- Simple routing system with handler function binding\n- Basic TCP networking abstraction for cross-platform use\n- Logging system for requests, responses, and errors\n- Multithreading support for better concurrency\n\n### 不久將來計劃 🎯\n\n- 支持多種文件類型（HTML / CSS / JS / JSON / images 等）\n- 更智能的資源查找，支持自定義路徑和相對路徑\n- 後臺終端命令接口，方便服務運維\n- 內存管理優化，避免內存泄漏和重複分配\n- 配置文件支持，方便定義端口、路徑和參數\n\n### Near-future Roadmap 🎯\n\n- Support multiple file types (HTML / CSS / JS / JSON / images, etc.)\n- Smarter resource locating, with custom and relative paths\n- Background terminal command interface for server management\n- Memory management optimization to prevent leaks and redundant allocation\n- Configuration file support for defining port, paths, and parameters\n\n### 遠期規劃 🔮\n\n- 數據庫支持（SQLite / MySQL / PostgreSQL 等）\n- RESTful API 與 JSONP 支持\n- 模板渲染引擎，方便動態頁面生成\n- 安全性增強（HTTPS / 請求驗證 / CSRF 保護）\n- 高級緩存和資源管理，提高性能\n- 模塊化插件系統，便於第三方功能擴展\n\n### Long-term Vision 🔮\n\n- Database integration (SQLite / MySQL / PostgreSQL, etc.)\n- RESTful API with JSONP support\n- Template rendering engine for dynamic page generation\n- Security enhancements (HTTPS / authentication / CSRF protection)\n- Advanced caching and resource management for better performance\n- Modular plugin system for third-party extensions\n\n## 快速嘗試 Quick to Try 🚀\n\n1. 克隆項目 Clone the repository:\n```bash\ngit clone https://github.com/yourusername/cweb.git\ncd cweb\n```\n\n2. 用 CMake 構建測試項目 Build the test using CMake:\n```bash\nmkdir cweb_test_build\ncd cweb_test_build\ncmake ../test\ncmake --build .\n```\n\n3. 運行服務器 Run the server\n```bash\n./cweb_test\n```\n\n1. 訪問：http://127.0.0.1:7878 Access: http://127.0.0.1:7878\n\n## 使用方法 / Usage 📦\n\n1. 定義路由和接口函數 Define routes and handler functions\n```c\nregister_get_route(\"/\", index_page);\nregister_post_route(\"/test_post\", test_post);\n```\n\n2. 實現接口函數 Implement handler functions\n```c\nPAGE(test_get) {\n    http_response_status_ok(res);\n    http_response_set_text(res, \"GET success\");\n}\n```\n\n3. 啟動服務器，接受請求 Start the server and handle requests\n```c\nwhile (1) {\n    NetSocket* client = net_accept(server);\n    handle_client(server, client);\n    net_close(client);\n}\n```\n\n## 目標與願景 Goals \u0026 Vision ✨\n\nCWeb 希望成為一個 輕量、靈活、可擴展 的 C 語言 Web 框架，既能作為學習和實驗平台，也可以逐步支持小型生產環境。\n\nCWeb aims to be a lightweight, flexible, and extensible C web framework suitable for learning, experimentation, and gradually small-scale production use.\n\n## 许可证 License 📄\n\nMIT License © 2025\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevepan643%2Fcweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevepan643%2Fcweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevepan643%2Fcweb/lists"}