Compare commits
4 commits
522a953331
...
ec2598a2cc
Author | SHA1 | Date | |
---|---|---|---|
|
ec2598a2cc | ||
|
6e80a243b7 | ||
|
bbeb44c12f | ||
|
82086814f5 |
4 changed files with 434 additions and 641 deletions
1059
Cargo.lock
generated
1059
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,7 @@ thiserror = "1"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
tower = { version = "0.4", features = ["full"] }
|
tower = { version = "0.4", features = ["full"] }
|
||||||
tower-http = { version = "0.5", features = ["fs"] }
|
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.
|
# See https://github.com/akesson/cargo-leptos for documentation of all the parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use app::components::api::Article;
|
use app::components::api::Article;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use serde::*;
|
use serde::*;
|
||||||
use sqlx::*;
|
use sqlx::{sqlite::SqlitePoolOptions, *};
|
||||||
|
|
||||||
pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
|
pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
|
||||||
let _res = query(
|
let _res = query(
|
||||||
|
@ -18,7 +18,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// println!("{:?}", _res);
|
println!("{:?}", _res);
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct ArticleFrontmatter {
|
struct ArticleFrontmatter {
|
||||||
|
@ -66,7 +66,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// println!("{:?}", _res);
|
println!("{:?}", _res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,9 +96,11 @@ pub async fn start_pool() -> Result<SqlitePool, ServerFnError> {
|
||||||
db goin up"
|
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)
|
Ok(pool)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ async fn main() {
|
||||||
let addr = leptos_options.site_addr;
|
let addr = leptos_options.site_addr;
|
||||||
let routes = generate_route_list(App);
|
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()
|
let app = Router::new()
|
||||||
.leptos_routes_with_context(
|
.leptos_routes_with_context(
|
||||||
|
|
Loading…
Add table
Reference in a new issue