steid

@jamesgill /

0d12f7dfeat: config from env and SQLite pool in app context1mo
1use sqlx::SqlitePool;
2use topcoat::{
3 Result,
4 context::{Cx, app_context},
5 router::page,
6 view::view,
7};
8
9/// Placeholder home page.
10///
11/// Milestone 0 only: it renders a value read through the pool to prove config,
12/// database, and app context are wired end to end. Milestone 1 replaces it with the
13/// profile page, which is the real home page.
14#[page("/")]
15async fn home(cx: &Cx) -> Result {
16 let pool: &SqlitePool = app_context(cx);
17 let sqlite_version: String = sqlx::query_scalar("select sqlite_version()")
18 .fetch_one(pool)
19 .await?;
20
21 view! {
22 <!DOCTYPE html>
23 <html>
24 <head>
25 <title>"steid"</title>
26 topcoat::dev::script()
27 </head>
28 <body>
29 <h1>"steid"</h1>
30 <p>"sqlite " (sqlite_version)</p>
31 </body>
32 </html>
33 }
34}