Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axum version needs to be pinned #5

Open
clvx opened this issue Jan 21, 2025 · 0 comments
Open

Axum version needs to be pinned #5

clvx opened this issue Jan 21, 2025 · 0 comments

Comments

@clvx
Copy link

clvx commented Jan 21, 2025

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?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant