Initial commit
This commit is contained in:
commit
4a04bfae91
31 changed files with 3297 additions and 0 deletions
18
src/http/novels/specific/get.rs
Normal file
18
src/http/novels/specific/get.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
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))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue