2024-01-25 02:40:50 -05:00
|
|
|
use app::*;
|
2024-01-26 18:09:06 -05:00
|
|
|
use axum::Router;
|
2024-01-25 02:40:50 -05:00
|
|
|
use fileserv::file_and_error_handler;
|
|
|
|
use leptos::*;
|
2024-01-25 15:15:22 -05:00
|
|
|
use leptos_axum::{build_static_routes, generate_route_list_with_exclusions_and_ssg, LeptosRoutes};
|
2024-01-25 02:40:50 -05:00
|
|
|
|
|
|
|
pub mod fileserv;
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
let conf = get_configuration(None).await.unwrap();
|
|
|
|
let leptos_options = conf.leptos_options;
|
|
|
|
let addr = leptos_options.site_addr;
|
2024-01-25 15:15:22 -05:00
|
|
|
let (routes, data) = generate_route_list_with_exclusions_and_ssg(App, None);
|
|
|
|
build_static_routes(&leptos_options, App, &routes, data).await;
|
2024-01-25 02:40:50 -05:00
|
|
|
|
|
|
|
let app = Router::new()
|
|
|
|
.leptos_routes(&leptos_options, routes, App)
|
|
|
|
.fallback(file_and_error_handler)
|
|
|
|
.with_state(leptos_options);
|
|
|
|
|
2024-01-26 18:09:06 -05:00
|
|
|
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
|
|
|
|
axum::serve(listener, app.into_make_service())
|
2024-01-25 02:40:50 -05:00
|
|
|
.await
|
|
|
|
.unwrap();
|
|
|
|
}
|