|
|
|
@ -9,6 +9,7 @@ use warp::{
|
|
|
|
|
Filter,
|
|
|
|
|
Buf,
|
|
|
|
|
reply::Response,
|
|
|
|
|
http,
|
|
|
|
|
};
|
|
|
|
|
use hyper::Body;
|
|
|
|
|
use std::{
|
|
|
|
@ -133,7 +134,12 @@ async fn main() {
|
|
|
|
|
.map(|x| format!("{} bytes fed", x))
|
|
|
|
|
.map_err(warp::reject::custom)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.map(|x| http::Response::builder()
|
|
|
|
|
.status(201)
|
|
|
|
|
.body(x)
|
|
|
|
|
.unwrap())
|
|
|
|
|
.with(warp::log("markov::put"));
|
|
|
|
|
|
|
|
|
|
let read = warp::get()
|
|
|
|
|
.and(chain.clone())
|
|
|
|
@ -149,7 +155,8 @@ async fn main() {
|
|
|
|
|
Ok::<_, std::convert::Infallible>(x)
|
|
|
|
|
}))))
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.with(warp::log("markov::read"));
|
|
|
|
|
|
|
|
|
|
let (addr, server) = warp::serve(push
|
|
|
|
|
.or(read))
|
|
|
|
|