2020-07-12 18:42:09 +00:00
|
|
|
use anyhow::Result;
|
2020-07-12 22:39:50 +00:00
|
|
|
use warp::{path, Filter};
|
2020-07-12 18:42:09 +00:00
|
|
|
|
|
|
|
pub mod app;
|
2020-07-12 22:39:50 +00:00
|
|
|
pub mod handlers;
|
2020-07-12 18:42:09 +00:00
|
|
|
pub mod signalboost;
|
|
|
|
|
|
|
|
const APPLICATION_NAME: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
pretty_env_logger::init();
|
|
|
|
|
|
|
|
let state = app::init()?;
|
|
|
|
|
2020-07-12 22:58:38 +00:00
|
|
|
let routes = warp::get()
|
|
|
|
.and(path::end().and_then(handlers::index))
|
|
|
|
.or(warp::path!("contact").and_then(handlers::contact))
|
|
|
|
.or(warp::path!("feeds").and_then(handlers::feeds));
|
2020-07-12 18:42:09 +00:00
|
|
|
|
2020-07-12 22:39:50 +00:00
|
|
|
let files = warp::path("static")
|
|
|
|
.and(warp::fs::dir("./static"))
|
|
|
|
.or(warp::path("css").and(warp::fs::dir("./css")));
|
|
|
|
|
2020-07-12 22:58:38 +00:00
|
|
|
let site = routes.or(files).with(warp::log(APPLICATION_NAME));
|
2020-07-12 22:39:50 +00:00
|
|
|
|
|
|
|
warp::serve(site).run(([127, 0, 0, 1], 3030)).await;
|
2020-07-12 18:42:09 +00:00
|
|
|
|
|
|
|
Ok(())
|
2020-07-12 16:54:33 +00:00
|
|
|
}
|
2020-07-12 22:39:50 +00:00
|
|
|
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
|