use axum::{Extension, Router, extract::Path, routing::get};
use super::*;
pub(super) fn routes(config: Config) -> Router {
Router::new()
.route("/v1", get(home))
.route("/v1/contract/web/{key}/", get(web_home_v1))
.with_state(config)
.route("/v1/contract/web/{key}/{*path}", get(web_subpages_v1))
}
async fn web_home_v1(
key: Path<String>,
rs: Extension<HttpClientApiRequest>,
config: axum::extract::State<Config>,
headers: axum::http::HeaderMap,
axum::extract::RawQuery(query): axum::extract::RawQuery,
) -> Result<axum::response::Response, WebSocketApiError> {
web_home(key, rs, config, headers, ApiVersion::V1, query).await
}
async fn web_subpages_v1(
Path((key, last_path)): Path<(String, String)>,
) -> Result<axum::response::Response, WebSocketApiError> {
web_subpages(key, last_path, ApiVersion::V1).await
}