diff options
Diffstat (limited to 'indexer/src/main.rs')
-rw-r--r-- | indexer/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 952af96..7d5a1af 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -32,7 +32,7 @@ struct AppState { async fn main() -> std::io::Result<()> { println!("Hello, world! Im the indexer!"); - serve_http_endpoint("0.0.0.0", 4444).await + serve_http_endpoint("0.0.0.0", 8080).await } async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { @@ -45,7 +45,16 @@ async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { .wrap(cors) .app_data(shared_state.clone()) .service(add_resource) - .service(web::resource(["/search", "/search/", "/search/{query}"]).to(search)) + .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() @@ -53,7 +62,7 @@ async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { } //TODO: sufficiently simmilar word in search (algorithm) -#[post("/resource")] +#[post("/api/resource")] async fn add_resource( data: web::Data<AppState>, resource: web::Json<CrawledResource>, |