mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Fix blank /web UI and /api route under the bundled server
The Flutter web bundle was built with the default base href of "/" but is served under "/web/", so index.html loaded while every asset reference resolved to the site root and 404'd, leaving a blank page. Build the bundle with --base-href=/web/ so asset URLs match the mount point. Also correct the root guidance text (the API explorer is at /api/docs, not /api) and add an /api -> /api/docs redirect for convenience. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d5d5ffa455
commit
cf8979f63d
@@ -13,7 +13,7 @@ use axum::Json;
|
||||
use axum::extract::Request;
|
||||
use axum::http::StatusCode;
|
||||
use axum::middleware::Next;
|
||||
use axum::response::Response;
|
||||
use axum::response::{Redirect, Response};
|
||||
use axum::routing::{delete, get, post, put};
|
||||
use axum::{Router, http};
|
||||
use log::{debug, error, info};
|
||||
@@ -170,8 +170,10 @@ pub async fn serve() -> Result<(), Box<dyn Error>> {
|
||||
.layer(ServiceBuilder::new().layer(cors_layer))
|
||||
.route(
|
||||
"/",
|
||||
get(|| async { "Go to /web for the UI or to /api for the better UI." }),
|
||||
get(|| async { "Go to /web for the UI or to /api/docs for the API explorer." }),
|
||||
)
|
||||
// The API explorer lives at /api/docs; redirect the bare /api for convenience.
|
||||
.route("/api", get(|| async { Redirect::temporary("/api/docs") }))
|
||||
.nest_service("/web", static_files)
|
||||
.merge(SwaggerUi::new("/api/docs").url("/api/docs/openapi.json", ApiDoc::openapi()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user