Skip to content

Commit

Permalink
feat: redirect to rustassistant.com
Browse files Browse the repository at this point in the history
  • Loading branch information
gengteng committed Jan 28, 2024
1 parent 84a8991 commit e09aa69
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/rust-assistant/src/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{CrateVersion, CrateVersionPath, FileLineRange, ItemQuery, LineQuery}
use axum::extract::{FromRequestParts, Path, Query, State};
use axum::http::request::Parts;
use axum::http::{HeaderMap, HeaderValue, StatusCode};
use axum::response::{IntoResponse, Response};
use axum::response::{IntoResponse, Redirect, Response};
use axum::routing::get;
use axum::{Extension, Json, Router};
use axum_extra::headers::authorization::Basic;
Expand Down Expand Up @@ -186,6 +186,12 @@ pub async fn read_crate_root_directory(
///
pub async fn health() {}

/// Redirect the client to "https://rustassistant.com".
///
pub async fn redirect() -> impl IntoResponse {
Redirect::to("https://rustassistant.com")
}

/// Privacy policy endpoint.
///
/// This endpoint provides access to the privacy policy of the Rust Assistant application.
Expand All @@ -201,7 +207,8 @@ pub async fn privacy_policy() -> impl IntoResponse {
///
pub fn router(auth_info: impl Into<Option<AuthInfo>>) -> Router {
let main = Router::new()
.route("/", get(health))
.route("/", get(redirect))
.route("/health", get(health))
.route("/privacy-policy", get(privacy_policy));

#[cfg(feature = "utoipa")]
Expand Down

0 comments on commit e09aa69

Please sign in to comment.