Skip to content

Commit

Permalink
refactor: move handlers up a level
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Apr 27, 2024
1 parent 20615bd commit 27684cf
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 197 deletions.
1 change: 0 additions & 1 deletion clientd-stateless/examples/cashu_encoding.rs

This file was deleted.

35 changes: 13 additions & 22 deletions clientd-stateless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::str::FromStr;
use anyhow::Result;
use axum::http::Method;
use fedimint_core::api::InviteCode;
use router::handlers;
use router::{check, info, keys, keysets, melt, mint, swap};
use tower_http::cors::{Any, CorsLayer};
use tower_http::trace::TraceLayer;
use tracing::info;
Expand Down Expand Up @@ -156,31 +156,22 @@ async fn main() -> Result<()> {
/// - DLEQ in BlindedSignature for Mint to User
fn cashu_v1_rest() -> Router<AppState> {
Router::new()
.route("/keys", get(handlers::keys::handle_keys))
.route(
"/keys/:keyset_id",
get(handlers::keys::handle_keys_keyset_id),
)
.route("/keysets", get(handlers::keysets::handle_keysets))
.route("/swap", post(handlers::swap::handle_swap))
.route(
"/mint/quote/:method",
get(handlers::mint::quote::handle_method),
)
.route("/keys", get(keys::handle_keys))
.route("/keys/:keyset_id", get(keys::handle_keys_keyset_id))
.route("/keysets", get(keysets::handle_keysets))
.route("/swap", post(swap::handle_swap))
.route("/mint/quote/:method", get(mint::quote::handle_method))
.route(
"/mint/quote/:method/:quote_id",
get(handlers::mint::quote::handle_method_quote_id),
)
.route("/mint/:method", post(handlers::mint::method::handle_method))
.route(
"/melt/quote/:method",
get(handlers::melt::quote::handle_method),
get(mint::quote::handle_method_quote_id),
)
.route("/mint/:method", post(mint::method::handle_method))
.route("/melt/quote/:method", get(melt::quote::handle_method))
.route(
"/melt/quote/:method/:quote_id",
get(handlers::melt::quote::handle_method_quote_id),
get(melt::quote::handle_method_quote_id),
)
.route("/melt/:method", post(handlers::melt::method::handle_method))
.route("/info", get(handlers::info::handle_info))
.route("/check", post(handlers::check::handle_check))
.route("/melt/:method", post(melt::method::handle_method))
.route("/info", get(info::handle_info))
.route("/check", post(check::handle_check))
}
File renamed without changes.
171 changes: 0 additions & 171 deletions clientd-stateless/src/router/handlers/mod.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
use tracing::{error, info};

use crate::error::AppError;
use crate::router::handlers::{Method, Unit};
use crate::router::{Method, Unit};
use crate::state::AppState;

#[derive(Debug, Deserialize)]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
use tracing::error;

use crate::error::AppError;
use crate::router::handlers::{Method, Unit};
use crate::router::{Method, Unit};
use crate::state::AppState;

#[derive(Debug, Deserialize)]
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 27684cf

Please sign in to comment.