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 <noreply@anthropic.com>
This commit is contained in:
@@ -159,7 +159,7 @@ mod inner {
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
|
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
|
||||||
#[server(endpoint = "/api/summarize")]
|
#[server(endpoint = "summarize")]
|
||||||
pub async fn summarize_article(
|
pub async fn summarize_article(
|
||||||
snippet: String,
|
snippet: String,
|
||||||
article_url: String,
|
article_url: String,
|
||||||
@@ -258,7 +258,7 @@ pub struct FollowUpMessage {
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
|
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
|
||||||
#[server(endpoint = "/api/chat")]
|
#[server(endpoint = "chat")]
|
||||||
pub async fn chat_followup(
|
pub async fn chat_followup(
|
||||||
messages: Vec<FollowUpMessage>,
|
messages: Vec<FollowUpMessage>,
|
||||||
ollama_url: String,
|
ollama_url: String,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ struct OllamaModel {
|
|||||||
///
|
///
|
||||||
/// Returns `ServerFnError` only on serialization issues; network failures
|
/// Returns `ServerFnError` only on serialization issues; network failures
|
||||||
/// are caught and returned as `online: false`
|
/// 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<OllamaStatus, ServerFnError> {
|
pub async fn get_ollama_status(ollama_url: String) -> Result<OllamaStatus, ServerFnError> {
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ mod inner {
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Returns `ServerFnError` if the SearXNG request fails or response parsing fails
|
/// 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<Vec<NewsCard>, ServerFnError> {
|
pub async fn search_topic(query: String) -> Result<Vec<NewsCard>, ServerFnError> {
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
use inner::{extract_source, rank_and_deduplicate, SearxngResponse};
|
use inner::{extract_source, rank_and_deduplicate, SearxngResponse};
|
||||||
@@ -196,7 +196,7 @@ pub async fn search_topic(query: String) -> Result<Vec<NewsCard>, ServerFnError>
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Returns `ServerFnError` if the SearXNG search request fails
|
/// Returns `ServerFnError` if the SearXNG search request fails
|
||||||
#[server(endpoint = "/api/trending")]
|
#[server(endpoint = "trending")]
|
||||||
pub async fn get_trending_topics() -> Result<Vec<String>, ServerFnError> {
|
pub async fn get_trending_topics() -> Result<Vec<String>, ServerFnError> {
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
use inner::SearxngResponse;
|
use inner::SearxngResponse;
|
||||||
|
|||||||
Reference in New Issue
Block a user