tomaka / rouille

Web framework in Rust
Apache License 2.0
1.12k stars 106 forks source link

How to match to route with multiple slashes? #226

Closed mankinskin closed 4 years ago

mankinskin commented 4 years ago

I would like to build a simple file server returning a html file with a directory tree, but I can't find how I can make a route that takes a path with "/" in it:

router!(request,
    (GET) (/{path: PathBuf}) => {
        handle_path(path.as_path())
    },
    _ => Response::empty_400()
)

This route does not seem to match something like "localhost:8000/src/main.rs". I would like to have several deep directories in my server root, so I would like to extract a full path from a route url. How would I do this with rouille?

mankinskin commented 4 years ago

Seems like match_assets does the job: https://docs.rs/rouille/3.0.0/rouille/fn.match_assets.html