Skip to content

Axum version needs to be pinned #5

@clvx

Description

@clvx

In the code/videos related to Axum, it's used 0.6.* but >0.7 has a breaking change..

cargo add axum -F multipart.

// Build Axum with an "extension" to hold the database connection pool
let app = Router::new()
    .route("/", get(test))
    .layer(Extension(pool));
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
    .serve(app.into_make_service())
    .await
    .unwrap();

to:

let app = Router::new()
    .route("/", get(test))
    .layer(Extension(pool));

    let listener = TcpListener::bind("127.0.0.1:3000").await?;
    axum::serve(listener, app).await?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions