remove warp static dir in favor of static_dir! macro
This commit is contained in:
parent
ac393b2b7b
commit
b7b303afb3
|
@ -2,8 +2,6 @@
|
||||||
web - The part of filed that handles everything related to HTTP
|
web - The part of filed that handles everything related to HTTP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::env::current_dir;
|
|
||||||
|
|
||||||
use static_dir::static_dir;
|
use static_dir::static_dir;
|
||||||
use warp::{Filter, reply::Reply, reject::Rejection};
|
use warp::{Filter, reply::Reply, reject::Rejection};
|
||||||
|
|
||||||
|
@ -19,15 +17,11 @@ mod uploaded;
|
||||||
use state::SharedState;
|
use state::SharedState;
|
||||||
|
|
||||||
pub fn routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
pub fn routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
||||||
let staticpath = current_dir().unwrap();
|
static_dir!("static")
|
||||||
let staticpath = staticpath.to_str().unwrap().to_string() + "/static";
|
.or(pages::get_routes(state.clone()))
|
||||||
|
|
||||||
pages::get_routes(state.clone())
|
|
||||||
.or(forms::get_routes(state.clone()))
|
.or(forms::get_routes(state.clone()))
|
||||||
.or(api::get_routes(state.clone()))
|
.or(api::get_routes(state.clone()))
|
||||||
.or(uploaded::get_uploaded(state))
|
.or(uploaded::get_uploaded(state))
|
||||||
.or(static_dir!("static"))
|
|
||||||
.or(warp::fs::dir(staticpath.to_string()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue