# Multiple Methods
A single route path can respond differently depending on the HTTP method used (GET, POST, PUT, DELETE, etc.). This is fundamental for building RESTful APIs.
#Using Macros
You can use multiple macros or the #[routes] macro (from some community extensions) but typically, you define separate handlers for different methods and bind them to the same path.
code_blocksrust
use actix_web::{get, post, web, HttpResponse};
#[get("/users")]
async fn list_users() -> HttpResponse {
HttpResponse::Ok().body("List users")
}
#[post("/users")]
async fn create_user() -> HttpResponse {
HttpResponse::Created().body("User created")
}#Using Manual Configuration
When configuring routes manually, you chain method guards using web::route().
code_blocksrust
use actix_web::{web, HttpResponse};
async fn handle_get() -> HttpResponse { HttpResponse::Ok().body("GET") }
async fn handle_post() -> HttpResponse { HttpResponse::Ok().body("POST") }
// In App configuration:
// .route("/resource", web::get().to(handle_get))
// .route("/resource", web::post().to(handle_post))