11 lines
312 B
Rust
11 lines
312 B
Rust
use super::api_error;
|
|
use super::FallibleApiResponse;
|
|
use rocket::get;
|
|
use serde_json::json;
|
|
|
|
#[get("/search?<query>")]
|
|
pub async fn search_route(query: String) -> FallibleApiResponse {
|
|
Ok(json!(crate::library::search::search_for(query)
|
|
.await
|
|
.ok_or_else(|| api_error("Search failed"))?))
|
|
}
|