Starting with a root path:
let root = warp::path::end()
.map(|| "Hello World, at root!");
I would like to construct .or()
Filters by configuration:
for path in web_server_config.paths {
root.or(warp::path(path).map(|| "OK")); // or any configurable response
}
I understand now that root
is cloned into or()
and returns a new instance and a different type that wraps the original type. So I would make root
mutable and reassign on each result of or()
, but I don't how to type root
correctly so that it can accept or()
results, and satisfy warp::serve