Compare commits
2 Commits
afc03bb722
...
560297ad88
Author | SHA1 | Date | |
---|---|---|---|
560297ad88 | |||
71badc7a78 |
17
back/Cargo.lock
generated
17
back/Cargo.lock
generated
|
@ -939,6 +939,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tower-http",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1575,6 +1576,22 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tower-http"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"bytes",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"http-body-util",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tower-layer",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-layer"
|
name = "tower-layer"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
|
|
|
@ -8,4 +8,5 @@ axum = "0.7.5"
|
||||||
serde = "1.0.204"
|
serde = "1.0.204"
|
||||||
sqlx = { version = "0.7.4", features = ["runtime-tokio", "sqlite"] }
|
sqlx = { version = "0.7.4", features = ["runtime-tokio", "sqlite"] }
|
||||||
tokio = { version = "1.38.1", features = ["rt-multi-thread", "macros", "net", "time", "sync"] }
|
tokio = { version = "1.38.1", features = ["rt-multi-thread", "macros", "net", "time", "sync"] }
|
||||||
|
tower-http = { version = "0.5.2", features = ["cors"] }
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.18"
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::str::FromStr;
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::State, http::StatusCode, routing::post, Json, Router
|
extract::State, http::StatusCode, routing::post, Json, Router
|
||||||
};
|
};
|
||||||
|
use tower_http::cors::CorsLayer;
|
||||||
|
|
||||||
use sqlx::{Row, sqlite::{SqliteConnectOptions, SqlitePoolOptions}, Pool, Sqlite};
|
use sqlx::{Row, sqlite::{SqliteConnectOptions, SqlitePoolOptions}, Pool, Sqlite};
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ async fn main() {
|
||||||
.route("/api/echo", post(echo))
|
.route("/api/echo", post(echo))
|
||||||
.route("/api/get_counter", post(get_counter))
|
.route("/api/get_counter", post(get_counter))
|
||||||
.route("/api/set_counter", post(set_counter))
|
.route("/api/set_counter", post(set_counter))
|
||||||
|
.layer(CorsLayer::permissive())
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
axum::serve(listener, app)
|
axum::serve(listener, app)
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
backend = platform.buildRustPackage {
|
backend = platform.buildRustPackage {
|
||||||
name = "plantback";
|
name = "plantback";
|
||||||
src = ./back;
|
src = ./back;
|
||||||
cargoLock = { lockFile = ./front/Cargo.lock; };
|
cargoLock = { lockFile = ./back/Cargo.lock; };
|
||||||
};
|
};
|
||||||
frontend = pkgs.buildNpmPackage {
|
frontend = pkgs.buildNpmPackage {
|
||||||
name = "plantfront";
|
name = "plantfront";
|
||||||
src = ./front;
|
src = ./front;
|
||||||
nodejs = node;
|
nodejs = node;
|
||||||
npmBuildScript = "build-only";
|
npmBuildScript = "build-only";
|
||||||
npmDepsHash = "sha256-QYmO99RkdhAN+vNOkBqeXYlfyHGyHfRKVVMIWYfZO1A=";
|
npmDepsHash = "sha256-0BTgt0zjKa6NPEAPyqJEkej0LuhglKpx645JpVSE2Ag=";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mv ./dist $out
|
mv ./dist $out
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user