dbui-controllers 0.0.64

HTTP controllers for the dbui server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use actix_session::Session;
use actix_web::{web, HttpRequest, HttpResponse};

use dbui_service::AppConfig;

/// Available at `/testbed/{key}`
pub fn testbed_key(session: Session, cfg: web::Data<AppConfig>, key: web::Path<String>, req: HttpRequest) -> HttpResponse {
  crate::act(&session, &cfg, req, |ctx, router| {
    let k: &str = &key;
    match k {
      "dump" => dbui_templates::testbed::dump(&ctx, router),
      "gallery" => dbui_templates::testbed::gallery(&ctx, router),
      "prototype" => dbui_templates::testbed::prototype(&ctx, router),
      "scroll" => dbui_templates::testbed::scroll(&ctx, router),
      _ => Err(anyhow::anyhow!("Cannot find testbed matching [{}]", key))
    }
  })
}