Merge pull request #5 from clowzed/feature/index-redirect

implemented redirecting from / to /index.html
This commit is contained in:
Dmitry Miasnenko 2023-11-02 02:23:36 +03:00 committed by GitHub
commit ee9026668f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -99,6 +99,18 @@ pub async fn download(
}
}
pub async fn index_redirect(
State(state): State<Arc<AppState>>,
SubdomainModelExtractor(subdomain): SubdomainModelExtractor,
) -> Response {
file(
State(state),
SubdomainModelExtractor(subdomain),
Path(String::from("index.html")),
)
.await
}
pub async fn file(
State(state): State<Arc<AppState>>,
SubdomainModelExtractor(subdomain): SubdomainModelExtractor,

View file

@ -57,6 +57,7 @@ async fn main() {
let mut app = Router::new()
.nest("/api", api_router)
.route("/*path", get(handlers::sites::file))
.route("/", get(handlers::sites::index_redirect))
.with_state(state.clone());
if config.max_body_limit_size.is_some() {