mirror of
https://github.com/ellmau/adf-obdd.git
synced 2025-12-20 09:39:38 +01:00
Serve static files from './assets' directory
This commit is contained in:
parent
99a158a7df
commit
b773410c50
55
Cargo.lock
generated
55
Cargo.lock
generated
@ -34,6 +34,29 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "actix-files"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689"
|
||||||
|
dependencies = [
|
||||||
|
"actix-http",
|
||||||
|
"actix-service",
|
||||||
|
"actix-utils",
|
||||||
|
"actix-web",
|
||||||
|
"askama_escape",
|
||||||
|
"bitflags",
|
||||||
|
"bytes",
|
||||||
|
"derive_more",
|
||||||
|
"futures-core",
|
||||||
|
"http-range",
|
||||||
|
"log",
|
||||||
|
"mime",
|
||||||
|
"mime_guess",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.3.1"
|
version = "3.3.1"
|
||||||
@ -220,6 +243,7 @@ name = "adf-bdd-server"
|
|||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
|
"actix-files",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"adf_bdd",
|
"adf_bdd",
|
||||||
"env_logger 0.9.3",
|
"env_logger 0.9.3",
|
||||||
@ -313,6 +337,12 @@ version = "0.1.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e"
|
checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "askama_escape"
|
||||||
|
version = "0.10.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "assert_cmd"
|
name = "assert_cmd"
|
||||||
version = "2.0.10"
|
version = "2.0.10"
|
||||||
@ -878,6 +908,12 @@ dependencies = [
|
|||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-range"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
@ -1071,6 +1107,16 @@ version = "0.3.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime_guess"
|
||||||
|
version = "2.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
|
||||||
|
dependencies = [
|
||||||
|
"mime",
|
||||||
|
"unicase",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minimal-lexical"
|
name = "minimal-lexical"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@ -1730,6 +1776,15 @@ version = "1.16.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicase"
|
||||||
|
version = "2.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
||||||
|
dependencies = [
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "unicode-bidi"
|
||||||
version = "0.3.13"
|
version = "0.3.13"
|
||||||
|
|||||||
@ -15,6 +15,7 @@ description = "Offer Solving ADFs as a service"
|
|||||||
adf_bdd = { version="0.3.1", path="../lib", features = ["frontend"] }
|
adf_bdd = { version="0.3.1", path="../lib", features = ["frontend"] }
|
||||||
actix-web = "4"
|
actix-web = "4"
|
||||||
actix-cors = "0.6"
|
actix-cors = "0.6"
|
||||||
|
actix-files = "0.6"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = "1"
|
serde = "1"
|
||||||
|
|||||||
@ -1,21 +1,17 @@
|
|||||||
use actix_web::{get, http, post, web, App, HttpResponse, HttpServer, Responder};
|
use actix_files as fs;
|
||||||
|
use actix_web::{post, web, App, HttpServer, Responder};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
#[cfg(feature = "cors_for_local_development")]
|
#[cfg(feature = "cors_for_local_development")]
|
||||||
use actix_cors::Cors;
|
use actix_cors::Cors;
|
||||||
|
#[cfg(feature = "cors_for_local_development")]
|
||||||
|
use actix_web::http;
|
||||||
|
|
||||||
use adf_bdd::adf::Adf;
|
use adf_bdd::adf::Adf;
|
||||||
use adf_bdd::datatypes::BddNode;
|
|
||||||
use adf_bdd::datatypes::Var;
|
use adf_bdd::datatypes::Var;
|
||||||
use adf_bdd::parser::AdfParser;
|
use adf_bdd::parser::AdfParser;
|
||||||
|
|
||||||
#[get("/")]
|
|
||||||
async fn root() -> impl Responder {
|
|
||||||
// TODO: this should serve the static files for the react frontend
|
|
||||||
HttpResponse::Ok().body("Hello world!")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
// This is a DTO for the graph output
|
// This is a DTO for the graph output
|
||||||
struct DoubleLabeledGraph {
|
struct DoubleLabeledGraph {
|
||||||
@ -170,15 +166,24 @@ async fn main() -> std::io::Result<()> {
|
|||||||
])
|
])
|
||||||
.max_age(3600);
|
.max_age(3600);
|
||||||
|
|
||||||
App::new().wrap(cors).service(root).service(solve)
|
App::new()
|
||||||
|
.wrap(cors)
|
||||||
|
.service(solve)
|
||||||
|
// this mus be last to not override anything
|
||||||
|
.service(fs::Files::new("/", "./assets").index_file("index.html"))
|
||||||
})
|
})
|
||||||
.bind(("127.0.0.1", 8080))?
|
.bind(("0.0.0.0", 8080))?
|
||||||
.run()
|
.run()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
#[cfg(not(feature = "cors_for_local_development"))]
|
#[cfg(not(feature = "cors_for_local_development"))]
|
||||||
let server = HttpServer::new(|| App::new().service(root).service(solve))
|
let server = HttpServer::new(|| {
|
||||||
.bind(("127.0.0.1", 8080))?
|
App::new()
|
||||||
|
.service(solve)
|
||||||
|
// this mus be last to not override anything
|
||||||
|
.service(fs::Files::new("/", "./assets").index_file("index.html"))
|
||||||
|
})
|
||||||
|
.bind(("0.0.0.0", 8080))?
|
||||||
.run()
|
.run()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user