Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.
/ attrouter Public archive

Attrouter is an attribute based router for various Rust web servers.

Notifications You must be signed in to change notification settings

stry-rs/attrouter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

(stry) attrouter

Attrouter is an attribute based router for various Rust web servers.

Web Servers

  • Tide
  • Warp

Examples

Add stry-attrouter, tokio, and warp to your dependencies:

stry-attrouter = { version = "0.1", default-features = false, features = [ "with-warp" ] }
tokio = { version = "0.2", features = ["full"] }
warp = "0.2"

And in your main.rs:

// GET /hello/warp => 200 OK with body "Hello, warp!"
#[stry_attrouter::get("/hello/{name}")]
fn hello(name: String) -> impl warp::Reply {
    format!("Hello, {}!", name)
}

#[tokio::main]
async fn main() {
    warp::serve(hello())
        .run(([127, 0, 0, 1], 3030))
        .await;
}

About

Attrouter is an attribute based router for various Rust web servers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages