add db
This commit is contained in:
parent
b15cff5689
commit
1c3121f8fe
4 changed files with 931 additions and 48 deletions
967
Cargo.lock
generated
967
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -12,3 +12,4 @@ axum.workspace = true
|
|||
tokio.workspace = true
|
||||
tower.workspace = true
|
||||
tower-http.workspace = true
|
||||
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "sqlite"] }
|
||||
|
|
6
server/src/db.rs
Normal file
6
server/src/db.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
use leptos::*;
|
||||
use sqlx::{Connection, SqliteConnection};
|
||||
|
||||
pub async fn db() -> Result<SqliteConnection, ServerFnError> {
|
||||
Ok(SqliteConnection::connect("sqlite::memory:").await?)
|
||||
}
|
|
@ -5,9 +5,12 @@ use leptos::*;
|
|||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
|
||||
pub mod fileserv;
|
||||
pub mod db;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
use db::*;
|
||||
let mut conn = db().await.expect("DB error");
|
||||
let conf = get_configuration(None).await.unwrap();
|
||||
let leptos_options = conf.leptos_options;
|
||||
let addr = leptos_options.site_addr;
|
||||
|
|
Loading…
Add table
Reference in a new issue