{"id":13672547,"url":"https://github.com/tobyapi/craft","last_synced_at":"2026-01-16T22:15:12.499Z","repository":{"id":57611135,"uuid":"205948377","full_name":"tobyapi/craft","owner":"tobyapi","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-04T22:24:19.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T01:36:57.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobyapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-02T22:57:23.000Z","updated_at":"2020-07-19T05:31:33.000Z","dependencies_parsed_at":"2022-09-16T00:20:21.165Z","dependency_job_id":null,"html_url":"https://github.com/tobyapi/craft","commit_stats":null,"previous_names":["tobiasgsmollett/craft"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyapi%2Fcraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyapi%2Fcraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyapi%2Fcraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyapi%2Fcraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyapi","download_url":"https://codeload.github.com/tobyapi/craft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219601,"owners_count":21554444,"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":[],"created_at":"2024-08-02T09:01:38.849Z","updated_at":"2026-01-16T22:15:12.465Z","avatar_url":"https://github.com/tobyapi.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Craft\nCraft is a lightweight HTTP framework.\n\n*Status:* **proof-of-concept**\n\n## Installation\nAdd this to your application's `Cargo.toml`.\n```sh\n[dependencies]\ncraft = \"0.1.0\"\n```\n\n## Usage\n```rust\nuse craft;\nuse hyper::*;\n\nfn hello(_request: \u0026Request\u003cBody\u003e) -\u003e Response\u003cBody\u003e {\n    Response::new(Body::from(\"Hello, World!\"))\n}\n\n#[runtime::main]\nasync fn main() {\n    let config = craft::Config::new(\"127.0.0.1\", 3000);\n\n    let mut handler_stack = craft::Stack::empty();\n    handler_stack.set(hello);\n    craft::get(\"/hello\", handler_stack);    \n\n    craft::start(\u0026config).await;\n}\n```\n\nCraft takes a modular-first approach to middlewares\n```rust\nuse craft;\nuse hyper::*;\n\nfn first_handler(_request: \u0026Request\u003cBody\u003e, next: \u0026dyn Fn() -\u003e Response\u003cBody\u003e) -\u003e Response\u003cBody\u003e {\n    println!(\"begin first_handler\");\n    let response = next();\n    println!(\"end first_handler\");\n    response\n}\n\nfn second_handler(_request: \u0026Request\u003cBody\u003e, next: \u0026dyn Fn() -\u003e Response\u003cBody\u003e) -\u003e Response\u003cBody\u003e {\n    println!(\"begin second_handler\");\n    let response = next();\n    println!(\"end second_handler\");\n    response\n}\n\nfn hello(_request: \u0026Request\u003cBody\u003e) -\u003e Response\u003cBody\u003e {\n    Response::new(Body::from(\"Hello, World!\"))\n}\n\n#[runtime::main]\nasync fn main() {\n    let config = craft::Config::new(\"127.0.0.1\", 3000);\n    let mut handler_stack = craft::Stack::empty();\n    handler_stack.push(first_handler);\n    handler_stack.push(second_handler);\n    handler_stack.set(hello);\n    craft::get(\"/hello\", handler_stack);\n    craft::start(\u0026config).await;\n}\n```\n\n## Development\n```sh\n$ cargo +nightly run --example hello\n$ cargo +nightly run --example multi_handler\n\n$ curl  -X GET localhost:3000/hello\nHello, World!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyapi%2Fcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyapi%2Fcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyapi%2Fcraft/lists"}