document api functions

This commit is contained in:
Sebastian Hugentobler 2025-07-01 14:07:08 +02:00
parent 552fce432b
commit 480e16d070
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
5 changed files with 38 additions and 0 deletions

View file

@ -1,3 +1,5 @@
//! HTTP API server for semantic search queries.
use std::{
io,
net::{AddrParseError, SocketAddr},
@ -20,6 +22,7 @@ pub mod state;
const TAG: &str = "little-librarian";
/// OpenAPI documentation configuration.
#[derive(OpenApi)]
#[openapi(
tags(
@ -28,6 +31,7 @@ const TAG: &str = "little-librarian";
)]
struct ApiDoc;
/// Errors that occur when starting the HTTP server.
#[derive(Debug, Snafu)]
pub enum ServeError {
#[snafu(display("Failed to parse address into <ip>:<port>."))]
@ -41,6 +45,7 @@ pub enum ServeError {
Serve { source: io::Error },
}
/// Start the HTTP API server with the given configuration.
pub async fn serve(
address: &str,
db: Postgres,