From 54276c34e54a907d1dfefe04b862d0ec2f1542da Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 15 Apr 2021 02:35:45 +0300 Subject: Add static serving support --- src/routes.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes.rs b/src/routes.rs index f8d9605..59342bb 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -7,14 +7,19 @@ use crate::schema::Db; /// Every route combined pub fn consensus_routes(db: Db) -> impl Filter + Clone { - let welcome_route = warp::path::end().and_then(handlers::welcome_handler); + // Remember when we wanted to implement templating + // Why would we? Just put a staic webpage under /public (next to Cargo.toml) and place it and + // the end of the filter chain - welcome_route - .or(transaction_list(db.clone())) + // Fully fledged website support, phew! + let static_route = warp::any().and(warp::fs::dir("public")); + + transaction_list(db.clone()) .or(register_user(db.clone())) .or(auth_transaction_propose(db.clone())) .or(auth_block_propose(db.clone())) .or(block_list(db.clone())) + .or(static_route) } /// POST /register warp route -- cgit v1.2.3-70-g09d2