mirror of
https://github.com/clowzed/sero
synced 2024-06-04 07:32:12 +02:00
Merge pull request #5 from clowzed/feature/index-redirect
implemented redirecting from / to /index.html
This commit is contained in:
commit
ee9026668f
|
@ -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,
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue