me-site/src/main.rs

38 lines
1 KiB
Rust
Raw Normal View History

2022-11-12 00:41:51 +01:00
mod config;
mod msg;
mod notification;
mod pages;
2023-09-16 17:53:03 +02:00
use actix_web::{web, App};
2022-11-12 00:41:51 +01:00
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "info");
std::env::set_var("RUST_BACKTRACE", "1");
env_logger::init();
let conf = config::Config::new();
2023-09-14 17:42:06 +02:00
web_base::bootstrap::cache_bootstrap().await;
2022-11-12 00:41:51 +01:00
2023-09-14 18:48:20 +02:00
web_base::map!(
web_base::Site::new()
.enable_bootstrap(true)
.enable_scaling(true)
.enable_favicon("/assets/me".to_string()),
|x: App<_>| {
x.app_data(web::Data::new(conf.clone()))
.service(pages::index::index)
// Assets
.service(pages::assets::wallpaper)
.service(pages::assets::me_img)
.service(pages::index::public_key)
.service(pages::index::mirrors)
.service(pages::index::message_page)
.service(pages::index::message_post)
}
)
2022-11-12 00:41:51 +01:00
.bind(("0.0.0.0", 8080))?
.run()
.await
}