diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-05 18:28:20 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-05 18:28:22 +0100 |
commit | 6d729376031e5d63bb4bc761f9d14d4f972e0793 (patch) | |
tree | 1fb0a40e40a337981b3317c48349d8243abababf /indexer/src/main.rs | |
parent | Indexer: Hold indexer lock for less time when in search endpoint (diff) | |
download | OSSE-6d729376031e5d63bb4bc761f9d14d4f972e0793.tar.gz OSSE-6d729376031e5d63bb4bc761f9d14d4f972e0793.tar.bz2 OSSE-6d729376031e5d63bb4bc761f9d14d4f972e0793.zip |
Indexer: Switch back to not serving frontend with actix
This previously caused the frontend to be unresponsive when the crawler was passing results to the indexer. Now the frontend is again independently served by trunk and the api by actix, which makes them separate processes and the frontend can remain responsive.
Diffstat (limited to 'indexer/src/main.rs')
-rw-r--r-- | indexer/src/main.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 8d738cd..592a0a6 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -32,35 +32,30 @@ struct AppState { async fn main() -> std::io::Result<()> { println!("Hello, world! Im the indexer!"); - serve_http_endpoint("0.0.0.0", 8080).await + serve_http_endpoint("0.0.0.0", 4444).await } async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { let shared_state = web::Data::new(AppState { - indexer: Mutex::new(Box::new(IndexerImplementation::new())), + indexer: Mutex::new(Box::new(IndexerImplementation::new())), //maybe mutex is not the best option }); HttpServer::new(move || { - let cors = Cors::permissive(); App::new() - .wrap(cors) + .wrap(Cors::permissive()) .app_data(shared_state.clone()) .service(add_resource) .service( web::resource(["/api/search", "/api/search/", "/api/search/{query}"]).to(search), ) - .service( - actix_web_lab::web::spa() - .index_file("./frontend/dist/index.html") - .static_resources_mount("/") - .static_resources_location("./frontend/dist") - .finish(), - ) //TODO: maybe separate gui backend from api? }) .bind((address, port))? .run() .await } +//TODO: Max description size +//TODO: Current result below search bar updates with it + //TODO: sufficiently simmilar word in search (algorithm) #[post("/api/resource")] async fn add_resource( |