🚀 Init public commit

This commit is contained in:
Markus Scully 2025-07-27 00:42:40 +03:00
commit 62fbf6d17c
Signed by: mascully
GPG key ID: 93CA5814B698101C
42 changed files with 7433 additions and 0 deletions

27
crates/server/Cargo.toml Normal file
View file

@ -0,0 +1,27 @@
[package]
name = "mascully_website_server"
version.workspace = true
edition.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
mascully_website_app = { path = "../app", default-features = false, features = [
"ssr",
] }
leptos = { workspace = true, features = ["ssr"] }
leptos_meta.workspace = true
leptos_router.workspace = true
leptos_dom.workspace = true
leptos_axum.workspace = true
gloo-net.workspace = true
log.workspace = true
futures.workspace = true
simple_logger.workspace = true
serde_json.workspace = true
reqwest.workspace = true
dotenvy.workspace = true
axum.workspace = true
tokio.workspace = true
tower.workspace = true
tower-http.workspace = true

23
crates/server/src/main.rs Normal file
View file

@ -0,0 +1,23 @@
use leptos::{logging::log, prelude::*};
use leptos_axum::{LeptosRoutes, generate_route_list};
use mascully_website_app::{App, shell};
#[tokio::main]
pub async fn main() {
let conf = get_configuration(None).unwrap();
let addr = conf.leptos_options.site_addr;
let leptos_options = conf.leptos_options;
let routes = generate_route_list(App);
let app = axum::Router::new()
.leptos_routes(&leptos_options, routes, {
let leptos_options = leptos_options.clone();
move || shell(leptos_options.clone())
})
.fallback(leptos_axum::file_and_error_handler(shell))
.with_state(leptos_options);
log!("listening on http://{}", &addr);
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service()).await.unwrap();
}