{"id":13440253,"url":"https://github.com/carllerche/tower-web","last_synced_at":"2025-05-15T06:03:01.357Z","repository":{"id":57670297,"uuid":"124959629","full_name":"carllerche/tower-web","owner":"carllerche","description":"A fast, boilerplate free, web framework for Rust","archived":false,"fork":false,"pushed_at":"2019-12-06T22:03:32.000Z","size":620,"stargazers_count":980,"open_issues_count":84,"forks_count":51,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-14T08:14:56.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/carllerche.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-12T22:31:22.000Z","updated_at":"2025-03-02T11:10:38.000Z","dependencies_parsed_at":"2022-09-26T20:40:58.631Z","dependency_job_id":null,"html_url":"https://github.com/carllerche/tower-web","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllerche%2Ftower-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllerche%2Ftower-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllerche%2Ftower-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllerche%2Ftower-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carllerche","download_url":"https://codeload.github.com/carllerche/tower-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259354,"owners_count":22040815,"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-07-31T03:01:21.096Z","updated_at":"2025-05-15T06:03:01.250Z","avatar_url":"https://github.com/carllerche.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Web programming","网络编程 Web programming","网页编程","web编程 Web programming"],"readme":"# Tower Web\n\nA web framework for Rust with a focus on removing boilerplate.\n\n[![Build Status](https://travis-ci.org/carllerche/tower-web.svg?branch=master)](https://travis-ci.org/carllerche/tower-web)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Crates.io](https://img.shields.io/crates/v/tower-web.svg?maxAge=2592000)](https://crates.io/crates/tower-web)\n[![Gitter](https://badges.gitter.im/tower-rs/tower.svg)](https://gitter.im/tower-rs/tower)\n\n[API Documentation][dox]\n\nTower Web is:\n\n* **Fast**: Fully asynchronous, built on [Tokio] and [Hyper].\n* **Ergonomic**: Tower-web decouples HTTP from your application logic, removing\n  all boilerplate.\n* **Works on Rust stable**: You can use it today.\n\n[Tokio]: https://github.com/tokio-rs/tokio\n[Hyper]: http://github.com/hyperium/hyper\n[dox]: https://docs.rs/tower-web/0.3.7/tower_web/\n\n## Hello World\n\n```rust\n#[macro_use]\nextern crate tower_web;\nextern crate tokio;\n\nuse tower_web::ServiceBuilder;\nuse tokio::prelude::*;\n\n/// This type will be part of the web service as a resource.\n#[derive(Clone, Debug)]\nstruct HelloWorld;\n\n/// This will be the JSON response\n#[derive(Response)]\nstruct HelloResponse {\n    message: \u0026'static str,\n}\n\nimpl_web! {\n    impl HelloWorld {\n        #[get(\"/\")]\n        #[content_type(\"json\")]\n        fn hello_world(\u0026self) -\u003e Result\u003cHelloResponse, ()\u003e {\n            Ok(HelloResponse {\n                message: \"hello world\",\n            })\n        }\n    }\n}\n\npub fn main() {\n    let addr = \"127.0.0.1:8080\".parse().expect(\"Invalid address\");\n    println!(\"Listening on http://{}\", addr);\n\n    ServiceBuilder::new()\n        .resource(HelloWorld)\n        .run(\u0026addr)\n        .unwrap();\n}\n```\n\n## Overview\n\nTower Web aims to decouple all HTTP concepts from the application logic. You\ndefine a \"plain old Rust method\" (PORM?). This method takes only the data it\nneeds to complete and returns a struct representing the response. Tower Web does\nthe rest.\n\nThe `impl_web` macro looks at the definition and generates the glue code,\nallowing the method to respond to HTTP requests.\n\n## Getting Started\n\nThe best way to get started is to read the [examples] and [API docs][dox].\n\n[dox]: #\n[examples]: examples/\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in `tower-web` by you, shall be licensed as MIT, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarllerche%2Ftower-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarllerche%2Ftower-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarllerche%2Ftower-web/lists"}