From faf446d93a9cb243b2a5cfde121c08593b41c989 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Thu, 26 Oct 2023 00:28:44 +0200 Subject: [PATCH] Add temp api handle --- src/web/rpc.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/web/rpc.rs b/src/web/rpc.rs index 5340a97..daae823 100644 --- a/src/web/rpc.rs +++ b/src/web/rpc.rs @@ -1,5 +1,26 @@ -use axum::Router; +use super::super::AppState; +use axum::routing::post; +use axum::{Json, Router}; +use tower_cookies::{Cookie, Cookies}; + +use axum::{ + extract::Extension, + extract::State, + http::{Request, StatusCode}, + middleware::{self, Next}, + response::{IntoResponse, Response}, +}; + +use tracing::info; pub fn routes() -> Router { - Router::new() + Router::new().route("/api", post(api_handler)) +} + +async fn api_handler( + State(state): State, + session: Extension, +) -> impl IntoResponse { + info!("api hit! user: {:?}", session.username); + StatusCode::NOT_IMPLEMENTED }