A route parameter is a variable value embedded in a URL path and passed to the handler selected by that route. In Actix, a route such as `/{tutor_id}` supplies the tutor identifier used to filter courses. section 3.2.5
Route parameters connect URL structure, handler arguments, and resource lookup:
- Define placeholders in route configuration, such as `/{tutor_id}` or `/{tutor_id}/{course_id}`. section 3.2.5 section 3.2.6
- Receive values through `web::Path`, either as a tuple or by destructuring a typed value. section 3.2.5 section 6.3.2
- Use extracted values to filter in-memory data or call database access functions before returning an `HttpResponse`. section 3.2.5 section 6.3.2
Nested course lookup
A request to `/courses/1/1` maps `tutor_id` and `course_id` to `web::Path<(i32, i32)>`; the handler returns the course matching both values. Tests construct the same path value manually. section 3.2.6
pub fn course_routes(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/courses")
.route("/", web::post().to(new_course))
.route("/{tutor_id}", web::get().to(get_courses_for_tutor))
.route("/{tutor_id}/{course_id}", web::get().to(get_course_detail)), #1
);
}
Inspect the route declaration that binds two URL segments to the single-course handler. section 3.2.6





