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
|
@ -5,10 +5,11 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app = { path = "../app", default-features = false, features = ["ssr"] }
|
app = { path = "../app", default-features = false, features = ["ssr"] }
|
||||||
leptos = { workspace = true, features = [ "ssr" ]}
|
leptos = { workspace = true, features = ["ssr"] }
|
||||||
leptos_axum.workspace = true
|
leptos_axum.workspace = true
|
||||||
|
|
||||||
axum.workspace = true
|
axum.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tower.workspace = true
|
tower.workspace = true
|
||||||
tower-http.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};
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
|
|
||||||
pub mod fileserv;
|
pub mod fileserv;
|
||||||
|
pub mod db;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
use db::*;
|
||||||
|
let mut conn = db().await.expect("DB error");
|
||||||
let conf = get_configuration(None).await.unwrap();
|
let conf = get_configuration(None).await.unwrap();
|
||||||
let leptos_options = conf.leptos_options;
|
let leptos_options = conf.leptos_options;
|
||||||
let addr = leptos_options.site_addr;
|
let addr = leptos_options.site_addr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue