Skip to content

Commit

Permalink
Add PUT and DELETE
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Nov 24, 2024
1 parent ea419e2 commit a22baab
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 16 deletions.
11 changes: 9 additions & 2 deletions examples/hello_world/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ use picoserve::routing::get;
async fn main() -> anyhow::Result<()> {
let port = 8000;

let app =
std::rc::Rc::new(picoserve::Router::new().route("/", get(|| async { "Hello World" })));
let app = std::rc::Rc::new(
picoserve::Router::new().route(
"/",
get(|| async { "Hello World" })
.post(|| async { "Hello post" })
.put(|| async { "Hello put" })
.delete(|| async { "Hello delete" }),
),
);

let config = picoserve::Config::new(picoserve::Timeouts {
start_read_request: Some(Duration::from_secs(5)),
Expand Down
Loading

0 comments on commit a22baab

Please sign in to comment.