aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/talks.rs
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-07-10 09:58:57 -0400
committerXe Iaso <me@christine.website>2022-07-10 09:58:57 -0400
commitb32f5a25afb7b9901476164663c1b7099dcec7a8 (patch)
tree3c97a73d002c46fef0184fad6c8c7fcf9b7bc30a /src/handlers/talks.rs
parent18ae8a01f883f19870df86bfa2e5cf288f79bce4 (diff)
downloadxesite-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.rs31
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()))
- }
- }
-}