diff options
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/Cargo.toml | 3 | ||||
-rw-r--r-- | indexer/src/main.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/indexer/Cargo.toml b/indexer/Cargo.toml index 97b8497..32355db 100644 --- a/indexer/Cargo.toml +++ b/indexer/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -actix-web = "*" +actix-web = "4.2.1" +actix-cors = "0.6.3" serde = { version = "1.0", features = ["derive"] } scraper = "0.12.0" html2text = "0.4.3" diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 44dbd1b..4ea81ae 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -1,3 +1,4 @@ +use actix_cors::Cors; use actix_web::{get, post, web, App, HttpServer, Responder}; use rand::Rng; use serde::{Deserialize, Serialize}; @@ -42,7 +43,9 @@ async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { database: Mutex::new(HashMap::new()), }); HttpServer::new(move || { + let cors = Cors::permissive(); App::new() + .wrap(cors) .app_data(shared_state.clone()) .service(search) .service(add_resource) |