feat: add basic website

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2026-03-07 19:46:13 +01:00
commit b439762877
71 changed files with 16576 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
use axum::extract::State;
use axum::response::Html;
use axum::routing::get;
use axum::Router;
use minijinja::context;
use crate::state::AppState;
pub fn router() -> Router<AppState> {
Router::new()
.route("/", get(landing))
.route("/pricing", get(pricing))
.route("/components", get(components))
}
async fn landing(State(state): State<AppState>) -> Result<Html<String>, axum::http::StatusCode> {
let html = state
.templates
.render("pages/landing.html.jinja", context! {
title => "Forage - The Platform for Forest",
description => "Push a forest.cue manifest, get production infrastructure.",
})
.map_err(|e| {
tracing::error!("template error: {e:#}");
axum::http::StatusCode::INTERNAL_SERVER_ERROR
})?;
Ok(Html(html))
}
async fn pricing(State(state): State<AppState>) -> Result<Html<String>, axum::http::StatusCode> {
let html = state
.templates
.render("pages/pricing.html.jinja", context! {
title => "Pricing - Forage",
description => "Simple, transparent pricing. Pay only for what you use.",
})
.map_err(|e| {
tracing::error!("template error: {e:#}");
axum::http::StatusCode::INTERNAL_SERVER_ERROR
})?;
Ok(Html(html))
}
async fn components(State(state): State<AppState>) -> Result<Html<String>, axum::http::StatusCode> {
let html = state
.templates
.render("pages/components.html.jinja", context! {
title => "Components - Forage",
description => "Discover and share reusable forest components.",
})
.map_err(|e| {
tracing::error!("template error: {e:#}");
axum::http::StatusCode::INTERNAL_SERVER_ERROR
})?;
Ok(Html(html))
}