2022-01-13 17:36:41 +00:00
|
|
|
use crate::dbs::Session;
|
|
|
|
use crate::web::conf;
|
2020-06-29 15:36:01 +00:00
|
|
|
use warp::http;
|
|
|
|
use warp::Filter;
|
|
|
|
|
|
|
|
pub fn config() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
|
|
|
|
// Set base path
|
|
|
|
let base = warp::path("export").and(warp::path::end());
|
|
|
|
// Set opts method
|
|
|
|
let opts = base.and(warp::options()).map(warp::reply);
|
|
|
|
// Set get method
|
2022-01-13 17:36:41 +00:00
|
|
|
let get = base.and(warp::get()).and(conf::build()).and_then(handler);
|
2020-06-29 15:36:01 +00:00
|
|
|
// Specify route
|
|
|
|
opts.or(get)
|
|
|
|
}
|
|
|
|
|
2022-01-13 17:36:41 +00:00
|
|
|
async fn handler(session: Session) -> Result<impl warp::Reply, warp::Rejection> {
|
2020-06-29 15:36:01 +00:00
|
|
|
Ok(warp::reply::with_status("Ok", http::StatusCode::OK))
|
|
|
|
}
|