I am trying to use the new Warp crate to serve some files for a toy project. The file structure is this:
src -|
|- main.rs
|- file1.txt
|- dir2 -|
|- file2.txt
The code in main.rs is this:
fn main() -> {
let file1 = warp::path("file1").and(warp::fs::file("./file1.txt"));
let file2 = warp::path("file2").and(warp::fs::file("./dir2/file2.txt"));
let routes = file1.or(file2);
warp::serve(routes).run(([127, 0, 0, 1], 3030));
Navigating to 127.0.0.1:3030/file1
or 127.0.0.1:3030/file2
returns No such file or directory (os error 2)
. What am I doing wrong?