From 680de0500eda3c9831e19d8416997b85fccd0b03 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Fri, 20 Feb 2026 06:57:33 +0100 Subject: [PATCH] fix(server): remove duplicate /api/ prefix from server function endpoints Dioxus mounts server functions under /api/ automatically. Our endpoints specified "/api/search" etc., resulting in double-prefixed paths like /api//api/search which hit the static file server (GET-only) instead of the server function handler, causing 405 errors. Co-Authored-By: Claude Opus 4.6 --- src/infrastructure/llm.rs | 4 ++-- src/infrastructure/ollama.rs | 2 +- src/infrastructure/searxng.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/infrastructure/llm.rs b/src/infrastructure/llm.rs index 46955c8..abaade2 100644 --- a/src/infrastructure/llm.rs +++ b/src/infrastructure/llm.rs @@ -159,7 +159,7 @@ mod inner { /// # Errors /// /// Returns `ServerFnError` if the Ollama request fails or response parsing fails -#[server(endpoint = "/api/summarize")] +#[server(endpoint = "summarize")] pub async fn summarize_article( snippet: String, article_url: String, @@ -258,7 +258,7 @@ pub struct FollowUpMessage { /// # Errors /// /// Returns `ServerFnError` if the Ollama request fails or response parsing fails -#[server(endpoint = "/api/chat")] +#[server(endpoint = "chat")] pub async fn chat_followup( messages: Vec, ollama_url: String, diff --git a/src/infrastructure/ollama.rs b/src/infrastructure/ollama.rs index 1b60964..0e8e248 100644 --- a/src/infrastructure/ollama.rs +++ b/src/infrastructure/ollama.rs @@ -45,7 +45,7 @@ struct OllamaModel { /// /// Returns `ServerFnError` only on serialization issues; network failures /// are caught and returned as `online: false` -#[server(endpoint = "/api/ollama-status")] +#[server(endpoint = "ollama-status")] pub async fn get_ollama_status(ollama_url: String) -> Result { dotenvy::dotenv().ok(); diff --git a/src/infrastructure/searxng.rs b/src/infrastructure/searxng.rs index 4181c90..f01194c 100644 --- a/src/infrastructure/searxng.rs +++ b/src/infrastructure/searxng.rs @@ -110,7 +110,7 @@ mod inner { /// # Errors /// /// Returns `ServerFnError` if the SearXNG request fails or response parsing fails -#[server(endpoint = "/api/search")] +#[server(endpoint = "search")] pub async fn search_topic(query: String) -> Result, ServerFnError> { dotenvy::dotenv().ok(); use inner::{extract_source, rank_and_deduplicate, SearxngResponse}; @@ -196,7 +196,7 @@ pub async fn search_topic(query: String) -> Result, ServerFnError> /// # Errors /// /// Returns `ServerFnError` if the SearXNG search request fails -#[server(endpoint = "/api/trending")] +#[server(endpoint = "trending")] pub async fn get_trending_topics() -> Result, ServerFnError> { dotenvy::dotenv().ok(); use inner::SearxngResponse;