Skip to content

Commit 519ed27

Browse files
authored
Merge pull request #166 from hyperware-ai/hf/hyperapp-allow-serving-ui-from-non-default-dir
hyperapp: allow serving ui from non-default dir
2 parents b21dd64 + 232fe25 commit 519ed27

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
@@ -420,12 +420,17 @@ where
420420

421421
pub fn setup_server(
422422
ui_config: Option<&HttpBindingConfig>,
423+
ui_path: Option<String>,
423424
endpoints: &[Binding],
424425
) -> http::server::HttpServer {
425426
let mut server = http::server::HttpServer::new(5);
426427

427428
if let Some(ui) = ui_config {
428-
if let Err(e) = server.serve_ui("ui", vec!["/"], ui.clone()) {
429+
if let Err(e) = server.serve_ui(
430+
&ui_path.unwrap_or_else(|| "ui".to_string()),
431+
vec!["/"],
432+
ui.clone(),
433+
) {
429434
panic!("failed to serve UI: {e}. Make sure that a ui folder is in /pkg");
430435
}
431436
}

0 commit comments

Comments
 (0)