더북(TheBook)

코드 4-34 /questions/:questionId에 PUT 경로 추가하기

...
#[tokio::main]
async fn main() {
    let get_questions = warp::get()
        .and(warp::path("questions"))
        .and(warp::path::end())
        .and(store_filter.clone())
        .and_then(get_questions);
        
    let add_question = warp::post()
        .and(warp::path("questions"))
        .and(warp::path::end())
        .and(store_filter.clone())
        .and(warp::body::json())
        .and_then(add_question);

    let update_question = warp::put() 
        .and(warp::path("questions")) 
        .and(warp::path::param::<String>()) 
        .and(warp::path::end()) 
        .and(store_filter.clone()) 
        .and(warp::body::json()) 
        .and_then(update_question);