2024-05-09 23:26:06 +02:00
|
|
|
use axum::{self};
|
2024-02-22 20:13:23 +01:00
|
|
|
use tower_http::services::ServeDir;
|
2024-02-27 22:53:08 +01:00
|
|
|
use tower_livereload::LiveReloadLayer;
|
2024-09-18 15:59:20 +02:00
|
|
|
use tracing::info;
|
2024-01-09 19:54:25 +01:00
|
|
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
|
|
|
|
2024-08-07 13:18:13 +02:00
|
|
|
mod blog_posts;
|
2024-01-18 22:33:36 +01:00
|
|
|
mod components;
|
2024-01-30 22:19:36 +01:00
|
|
|
mod feed;
|
2024-02-27 23:32:16 +01:00
|
|
|
mod filters;
|
2024-01-11 20:43:47 +01:00
|
|
|
mod pages;
|
2024-08-16 20:22:19 +02:00
|
|
|
mod picture_generator;
|
2024-08-07 13:18:13 +02:00
|
|
|
mod post_utils;
|
|
|
|
mod projects;
|
2024-01-09 20:54:36 +01:00
|
|
|
mod router;
|
2024-01-11 20:43:47 +01:00
|
|
|
// mod template;
|
2024-01-09 20:54:36 +01:00
|
|
|
|
2024-01-09 19:54:25 +01:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
tracing_subscriber::registry()
|
|
|
|
.with(
|
|
|
|
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
|
|
|
|
// axum logs rejections from built-in extractors with the `axum::rejection`
|
|
|
|
// target, at `TRACE` level. `axum::rejection=trace` enables showing those events
|
|
|
|
"axum_server=debug,tower_http=debug,axum::rejection=trace".into()
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
.with(tracing_subscriber::fmt::layer())
|
|
|
|
.init();
|
|
|
|
|
|
|
|
// build our application with a single route
|
2024-03-02 13:12:55 +01:00
|
|
|
let app = router::get_router()
|
|
|
|
.nest_service("/styles", ServeDir::new("styles"))
|
2024-03-13 19:14:10 +01:00
|
|
|
.nest_service("/images", ServeDir::new("../static/images"))
|
2024-09-13 23:21:51 +02:00
|
|
|
.nest_service("/fonts", ServeDir::new("../static/fonts"))
|
2024-09-05 21:23:28 +02:00
|
|
|
.nest_service("/generated_images", ServeDir::new("generated_images"))
|
2024-05-09 23:26:06 +02:00
|
|
|
.nest_service("/svg", ServeDir::new("../static/svg"))
|
|
|
|
.nest_service(
|
|
|
|
"/config.yml",
|
|
|
|
ServeDir::new("../static/resources/config.yml"),
|
|
|
|
);
|
2024-02-27 22:53:08 +01:00
|
|
|
|
|
|
|
#[cfg(debug_assertions)]
|
|
|
|
let app = app.layer(LiveReloadLayer::new());
|
|
|
|
|
2024-01-09 19:54:25 +01:00
|
|
|
// run our app with hyper, listening globally on port 3080
|
2024-01-18 20:53:39 +01:00
|
|
|
let port = std::option_env!("PORT").unwrap_or("3080");
|
|
|
|
let addr = format!("0.0.0.0:{}", port);
|
2024-09-18 15:59:20 +02:00
|
|
|
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
|
|
|
|
info!("axum_server listening on http://{}", &addr);
|
2024-01-09 19:54:25 +01:00
|
|
|
axum::serve(listener, app).await.unwrap();
|
|
|
|
}
|
|
|
|
|
2024-09-15 22:08:44 +02:00
|
|
|
// TODO Socials
|
2024-09-18 12:47:25 +02:00
|
|
|
// - fotos
|
2024-09-15 22:08:44 +02:00
|
|
|
// TODO ul li article styles
|
|
|
|
// TODO header height difference
|
2024-09-10 21:58:57 +02:00
|
|
|
// TODO Colors
|
2024-09-15 22:08:44 +02:00
|
|
|
// TODO print css and other 404 css linked in base.html
|
2024-09-06 11:23:44 +02:00
|
|
|
// TODO go live pipeline
|
2024-09-15 22:08:44 +02:00
|
|
|
// TODO after release
|
|
|
|
// - contact
|
|
|
|
// - projects page
|
|
|
|
// - linktree page
|