Compare commits

..

4 commits

Author SHA1 Message Date
Adam
ec2598a2cc maybe fix disappearing db 2024-05-18 22:12:13 -04:00
Adam
6e80a243b7 update deps 2024-05-18 22:12:00 -04:00
Adam
bbeb44c12f add type for clarity 2024-02-13 22:10:31 -05:00
Adam
82086814f5 update deps 2024-02-13 22:09:14 -05:00
4 changed files with 434 additions and 641 deletions

1059
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ thiserror = "1"
tokio = { version = "1", features = ["full"] }
tower = { version = "0.4", features = ["full"] }
tower-http = { version = "0.5", features = ["fs"] }
wasm-bindgen = "0.2.89"
wasm-bindgen = "0.2.92"
# See https://github.com/akesson/cargo-leptos for documentation of all the parameters.

View file

@ -1,7 +1,7 @@
use app::components::api::Article;
use leptos::*;
use serde::*;
use sqlx::*;
use sqlx::{sqlite::SqlitePoolOptions, *};
pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
let _res = query(
@ -18,7 +18,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
.execute(pool)
.await?;
// println!("{:?}", _res);
println!("{:?}", _res);
#[derive(Deserialize)]
struct ArticleFrontmatter {
@ -66,7 +66,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
.execute(pool)
.await?;
// println!("{:?}", _res);
println!("{:?}", _res);
}
}
}
@ -96,9 +96,11 @@ pub async fn start_pool() -> Result<SqlitePool, ServerFnError> {
db goin up"
);
let pool = SqlitePool::connect("sqlite://doordesk.db").await?;
let pool = SqlitePoolOptions::new()
.connect("file::memory:?cache=shared")
.await?;
let _ = db_build(&pool);
let _ = db_build(&pool).await?;
Ok(pool)
}

View file

@ -15,7 +15,7 @@ async fn main() {
let addr = leptos_options.site_addr;
let routes = generate_route_list(App);
let pool = start_pool().await.expect("pool error");
let pool: sqlx::SqlitePool = start_pool().await.expect("pool error");
let app = Router::new()
.leptos_routes_with_context(