From 51a4c78bd5b27c73e5f375693010dcf95d9b2c21 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Mon, 5 Jun 2023 10:38:14 +0200 Subject: [PATCH] Setup tutorial --- Cargo.toml | 15 +++++++++++++++ README.md | 8 +++++++- backend/Cargo.toml | 15 +++++++++++++++ {src => backend/src}/main.rs | 0 common/Cargo.toml | 8 ++++++++ common/src/lib.rs | 7 +++++++ frontend/Cargo.toml | 16 ++++++++++++++++ frontend/src/lib.rs | 7 +++++++ 8 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Cargo.toml create mode 100644 backend/Cargo.toml rename {src => backend/src}/main.rs (100%) create mode 100644 common/Cargo.toml create mode 100644 common/src/lib.rs create mode 100644 frontend/Cargo.toml create mode 100644 frontend/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..640ae5d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "HambiMap" +version = "0.1.0" +authors = ["Gandalf "] +edition = "2018" + +[workspace] + +members = [ + "backend", + "frontend", + + #Internal + "common" +] diff --git a/README.md b/README.md index 62702a9..b9d9741 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # HambiMap -Code for a Website that collects stories and photos from 11 years of Hambach Forest occupation, with the goal of producing info tables to put up in the forest \ No newline at end of file +Code for a Website that collects stories and photos from 11 years of Hambach Forest occupation, with the goal of producing info tables to put up in the forest + +## Tutorial branch +I'll use this branch to follow [this tutorial](https://blog.logrocket.com/full-stack-rust-a-complete-tutorial-with-examples/) + +This uses postgresql as database, my original plan was sqlite. Let's see. +Also I'm not sure if wasm is the frontend I want. diff --git a/backend/Cargo.toml b/backend/Cargo.toml new file mode 100644 index 0000000..5c7d8c4 --- /dev/null +++ b/backend/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "backend" +version = "0.1.0" +authors = ["Gandalf "] +edition = "2018" + +[dependencies] +tokio = { version = "=1.6.1", features = ["macros", "rt-multi-thread"] } +warp = "=0.3.1" +mobc = "=0.7.2" +mobc-postgres = { version = "=0.7.0", features = ["with-chrono-0_4", "with-serde_json-1"] } +serde = {version = "=1.0.126", features = ["derive"] } +serde_json = "=1.0.64" +thiserror = "=1.0.24" +common = { version = "0.1.0", path = "../common" } diff --git a/src/main.rs b/backend/src/main.rs similarity index 100% rename from src/main.rs rename to backend/src/main.rs diff --git a/common/Cargo.toml b/common/Cargo.toml new file mode 100644 index 0000000..0e5a182 --- /dev/null +++ b/common/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "common" +version = "0.1.0" +authors = ["Gandalf "] +edition = "2018" + +[dependencies] +serde = {version = "=1.0.126", features = ["derive"] } diff --git a/common/src/lib.rs b/common/src/lib.rs new file mode 100644 index 0000000..31e1bb2 --- /dev/null +++ b/common/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml new file mode 100644 index 0000000..9aa567d --- /dev/null +++ b/frontend/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "frontend" +version = "0.1.0" +authors = ["Gandalf "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +yew = "0.18" +wasm-bindgen = "0.2.67" +serde_json = "1" +serde = {version = "=1.0.126", features = ["derive"] } +anyhow = "1" +yew-router = "0.15.0" +common = { version = "0.1.0", path = "../common" } diff --git a/frontend/src/lib.rs b/frontend/src/lib.rs new file mode 100644 index 0000000..31e1bb2 --- /dev/null +++ b/frontend/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +}