18 lines
428 B
Rust
18 lines
428 B
Rust
use axum::{extract::Path, routing::get};
|
|
|
|
use crate::{
|
|
result::ApiResult,
|
|
schemas::{novel::FullNovel, sanity::Slug},
|
|
state::{Router, State},
|
|
};
|
|
|
|
async fn get_novel(Path(slug): Path<Slug>, state: State) -> ApiResult<FullNovel> {
|
|
let entry = state.app.read().novel(&slug.0)?;
|
|
let novel = entry.get_full_info()?;
|
|
|
|
Ok(novel.into())
|
|
}
|
|
|
|
pub fn make() -> Router {
|
|
Router::new().route("/", get(get_novel))
|
|
}
|