salvo-routing
Salvo Routing
Salvo treats path, method, and custom conditions uniformly as filters. Routers are composable (push), reusable across multiple mount points, and share middleware with handlers via hoop().
Path parameters
Salvo uses {name} syntax (since v0.76; the older <name> form is removed).
Router::with_path("users").get(list_users) // static
Router::with_path("users/{id}").get(show_user) // basic param
Router::with_path("users/{id:num}").get(show_user) // typed: num, i32, i64, u32, u64
Router::with_path(r"users/{id|\d+}").get(show_user) // regex
Router::with_path("files/{*rest}").get(serve_file) // single segment wildcard
Router::with_path("static/{**path}").get(serve_static) // multi-segment wildcard
Access in a handler via req.param::<T>("name") which returns Option<T>:
More from salvo-rs/salvo-skills
salvo-realtime
Implement real-time features using WebSocket and Server-Sent Events (SSE). Use for chat applications, live updates, notifications, and bidirectional communication.
17salvo-csrf
Implement CSRF (Cross-Site Request Forgery) protection using cookie or session storage. Use for protecting forms and state-changing endpoints.
17salvo-auth
Implement authentication and authorization using JWT, Basic Auth, or custom schemes. Use for securing API endpoints and user management.
16salvo-websocket
Implement WebSocket connections for real-time bidirectional communication. Use for chat, live updates, gaming, and collaborative features.
16salvo-proxy
Implement reverse proxy to forward requests to backend services. Use for load balancing, API gateways, and microservices routing.
16salvo-cors
Configure Cross-Origin Resource Sharing (CORS) and security headers. Use for APIs accessed from browsers on different domains.
16