diff options
| author | Xe Iaso <me@christine.website> | 2022-07-10 09:58:57 -0400 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-07-10 09:58:57 -0400 |
| commit | b32f5a25afb7b9901476164663c1b7099dcec7a8 (patch) | |
| tree | 3c97a73d002c46fef0184fad6c8c7fcf9b7bc30a /src/handlers/talks.rs | |
| parent | 18ae8a01f883f19870df86bfa2e5cf288f79bce4 (diff) | |
| download | xesite-b32f5a25afb7b9901476164663c1b7099dcec7a8.tar.xz xesite-b32f5a25afb7b9901476164663c1b7099dcec7a8.zip | |
consolidate API routes
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src/handlers/talks.rs')
| -rw-r--r-- | src/handlers/talks.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/handlers/talks.rs b/src/handlers/talks.rs index 6d0e782..59d8676 100644 --- a/src/handlers/talks.rs +++ b/src/handlers/talks.rs @@ -3,7 +3,6 @@ use crate::{app::State, post::Post, templates}; use axum::{ extract::{Extension, Path}, response::Html, - Json, }; use http::header::HeaderMap; use lazy_static::lazy_static; @@ -17,11 +16,6 @@ lazy_static! { &["name"] ) .unwrap(); - static ref HIT_COUNTER_JSON: IntCounterVec = register_int_counter_vec!( - opts!("talks_json_hits", "Number of hits to talks images"), - &["name"] - ) - .unwrap(); } #[instrument(skip(state))] @@ -67,28 +61,3 @@ pub async fn post_view( } } } - -#[instrument(skip(state))] -pub async fn post_json( - Path(name): Path<String>, - Extension(state): Extension<Arc<State>>, -) -> Result<Json<xe_jsonfeed::Item>> { - let mut want: Option<Post> = None; - let want_link = format!("talks/{}", name); - - for post in &state.talks { - if post.link == want_link { - want = Some(post.clone()); - } - } - - match want { - None => Err(super::Error::PostNotFound(name)), - Some(post) => { - HIT_COUNTER_JSON - .with_label_values(&[name.clone().as_str()]) - .inc(); - Ok(Json(post.into())) - } - } -} |
