Expand description
Pillow a web framework
§Example
In src/main.rs
use pillow::http::*;
#[controller(method = "GET", path = "/")]
fn index(){
Response::text("hello")
}
#[tokio::main]
fn main(){
let mut router= MainRouter::new();
router.add_route(route!(index {}));
router.post("/post", |request|{
println!("{:#?}", request);
Response::text("hello")
})
let server = Server::default();
server.run(router).await;
}cargo run
$ Server on 127.0.0.1:5000Modules§
Macros§
- json
- Construct a
serde_json::Valuefrom a JSON literal.