405 Method not allowed error for my delete and patch requests but post and get requests work fine #2417
Answered
by
davidpdrsn
Benbellah-Owino
asked this question in
Q&A
-
SummaryMy get and post request are working fine but my patch and delete won't work. pub fn routes(db: Db) -> Router{
} axum version0.7.1 |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Dec 11, 2023
Replies: 1 comment 1 reply
-
There's gotta be something else wrong because that does work. I just tested this use axum::{routing::*, Router};
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/todo", post(|| async {}).get(|| async {}))
.route("/todo/:id", delete(|| async {}).patch(|| async {}));
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
.await
.unwrap();
axum::serve(listener, app).await.unwrap();
}
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davidpdrsn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's gotta be something else wrong because that does work. I just tested this