Change to DSL for wildcard routes #1

Open
opened 2024-07-29 11:11:06 +00:00 by BlakeRain · 0 comments
Owner

Currently wildcard routes are written as *"/some/route" (note the * is before the string). This is strange, and I'm not sure why I did that. The * should really move after the string. This would change the example from the README as follows:

fn build_routes(my_data: MyData) -> impl IntoEndpoint {
    define_routes!(Route::new(), {
        // Nest a static files endpoint
        "/static"*      { StaticFilesEndpoint::new("./static") }

        // Standard routes
        "/"             index               GET
        "/pastes"       paste::pastes       GET
        "/pastes/:id"   paste::paste        GET POST

        // A nested route for administration
        "/admin"*       { admin::build_routes() }
    })
    .data(my_data)
}
Currently wildcard routes are written as `*"/some/route"` (note the `*` is _before_ the string). This is strange, and I'm not sure why I did that. The `*` should really move _after_ the string. This would change the example from the README as follows: ```rust fn build_routes(my_data: MyData) -> impl IntoEndpoint { define_routes!(Route::new(), { // Nest a static files endpoint "/static"* { StaticFilesEndpoint::new("./static") } // Standard routes "/" index GET "/pastes" paste::pastes GET "/pastes/:id" paste::paste GET POST // A nested route for administration "/admin"* { admin::build_routes() } }) .data(my_data) } ```
BlakeRain added the
enhancement
label 2024-07-29 11:11:06 +00:00
BlakeRain added this to the v0.1.0 milestone 2024-07-29 11:12:32 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: BlakeRain/poem-route-macro#1
No description provided.