summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index e247211..0726f87 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,20 +27,15 @@ async fn main() -> Result<()> {
let index = warp::get().and(path::end().and_then(misc::handlers::index));
- let blog_base = warp::path!("blog" / ..);
- let blog_list = blog_base.and(give_site_state(state.clone())).and_then(blog::handlers::list);
- let blog_post = blog_base.and(
- warp::path!(String)
- .and(give_site_state(state.clone()))
- .and_then(blog::handlers::post),
- );
+ let blog_index = warp::path!("blog").and(give_site_state(state.clone())).and_then(blog::handlers::list);
+
+ let blog_post = warp::path!("blog" / String).and(give_site_state(state.clone())).and_then(blog::handlers::post);
+
+
let static_files = warp::path("static")
.and(warp::fs::dir("./statics"));
- let site = index
- .or(blog_list.or(blog_post))
- .or(static_files).with(warp::log("site"));
-
+ let site = index.or(blog_index.or(blog_post)).or(static_files).with(warp::log("site"));
let server = warp::serve(site);