A web framework for Rust with a focus on removing boilerplate.
Tower Web is:
```rust
extern crate tower_web; extern crate tokio;
use tower_web::ServiceBuilder; use tokio::prelude::*;
/// This type will be part of the web service as a resource.
struct HelloWorld;
/// This will be the JSON response
struct HelloResponse { message: &'static str, }
implweb! {
impl HelloWorld {
#[get("/")]
#[contenttype("json")]
fn hello_world(&self) -> Result pub fn main() {
let addr = "127.0.0.1:8080".parse().expect("Invalid address");
println!("Listening on http://{}", addr); }
``` Tower Web aims to decouple all HTTP concepts from the application logic. You
define a "plain old Rust method" (PORM?). This method takes only the data it
needs to complete and returns a struct representing the response. Tower Web does
the rest. The In order to work on Rust stable today, Tower Web uses doc comments as
attributes. Once Macro 1.2 lands, this will be switched to real attributes. The best way to get started is to read the [examples] and API docs. This project is licensed under the MIT license. Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in ServiceBuilder::new()
.resource(HelloWorld)
.run(&addr)
.unwrap();
Overview
impl_web
macro looks at the definition and generates the glue code,
allowing the method to respond to HTTP requests.Getting Started
License
Contribution
tower-web
by you, shall be licensed as MIT, without any
additional terms or conditions.