I am writing an example for a template system (neutralts) in axum, the thing is that I have never used axum and I get a lot of errors when I try to read get parameters and cookies. the example is simply this:

async fn home_handler() -> Response<String> {
 ..
}

async fn handle_404() -> Response<String> {
     ...
}

#[tokio::main]
async fn main() {
    let app = Router::new()
        .route("/", get(home_handler))
        .fallback(handle_404);

    let addr = ([127, 0, 0, 1], 9090).into();
    axum::Server::bind(&addr)
        .serve(app.into_make_service())
        .await
        .unwrap();
}

Can someone help me to make home_handler able to read cookies and get variables? I could use a link with examples about this.

3 posts - 2 participants

Read full topic

Source: View source