document api functions
This commit is contained in:
parent
552fce432b
commit
480e16d070
5 changed files with 38 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue