bobashare_web/api/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Public facing REST API for bobashare

use axum::Router;
use hyper::StatusCode;

use crate::AppState;

pub mod v1;

/// Routes under `/api/`
///
/// - `/api/v1/`: [`v1`]
/// - `/api/latest/`: [`v1`] (latest API version)
pub fn router() -> Router<&'static AppState> {
    Router::new()
        .nest("/v1", v1::router())
        .nest("/latest", v1::router())
        .fallback(|| async { (StatusCode::NOT_FOUND, "error: api route not found") })
}