Function feattle_ui::run_warp_server

source ·
pub async fn run_warp_server<F>(
    admin_panel: Arc<AdminPanel<F>>,
    addr: impl Into<SocketAddr> + 'static,
where F: Feattles + Sync + Send + 'static,
Expand description

Run the given admin panel using warp framework.

To use it, make sure to activate the cargo feature "warp" in your Cargo.toml.

This will host the web UI under “/” and a JSON API under “/api/v1/” (see more at v1):

  • GET /api/v1/feattles
  • GET /api/v1/feattle/{key}
  • POST /api/v1/feattle/{key}


use feattle_ui::{AdminPanel, run_warp_server};
use feattle_core::{feattles, Feattles};
use feattle_core::persist::NoPersistence;
use std::sync::Arc;

feattles! {
    struct MyToggles { a: bool, b: i32 }

// `NoPersistence` here is just a mock for the sake of the example
let my_toggles = Arc::new(MyToggles::new(Arc::new(NoPersistence)));
let admin_panel = Arc::new(AdminPanel::new(my_toggles, "Project Panda - DEV".to_owned()));

run_warp_server(admin_panel, ([127, 0, 0, 1], 3030)).await;