Skip to content

GET-only route for ServeFile? #2788

Answered by jplatte
maximecb asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, quite easy:

use axum::routing::{get, get_service};

let app = Router::new()
    .route("/", get(get_index))
    .route(
        "/submit",
        get_service(ServeFile::new("public/submit.html")).post(submit),
    );

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maximecb
Comment options

Answer selected by maximecb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants