Skip to content

Commit 232fe25

Browse files
committed
hyperapp: allow serving ui from non-default dir
1 parent d67b65e commit 232fe25

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/hyperapp.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,17 @@ where
396396

397397
pub fn setup_server(
398398
ui_config: Option<&HttpBindingConfig>,
399+
ui_path: Option<String>,
399400
endpoints: &[Binding],
400401
) -> http::server::HttpServer {
401402
let mut server = http::server::HttpServer::new(5);
402403

403404
if let Some(ui) = ui_config {
404-
if let Err(e) = server.serve_ui("ui", vec!["/"], ui.clone()) {
405+
if let Err(e) = server.serve_ui(
406+
&ui_path.unwrap_or_else(|| "ui".to_string()),
407+
vec!["/"],
408+
ui.clone(),
409+
) {
405410
panic!("failed to serve UI: {e}. Make sure that a ui folder is in /pkg");
406411
}
407412
}

0 commit comments

Comments
 (0)