Skip to main content

haystack_server/ops/
mod.rs

1//! Haystack HTTP API op handlers and route registration.
2
3pub mod about;
4pub mod data;
5pub mod defs;
6pub mod federation;
7pub mod formats;
8pub mod his;
9pub mod invoke;
10pub mod libs;
11pub mod nav;
12pub mod ops_handler;
13pub mod point_write;
14pub mod rdf;
15pub mod read;
16pub mod system;
17pub mod watch;
18
19use actix_web::web;
20
21/// Configure all Haystack API routes under `/api`.
22pub fn configure(cfg: &mut web::ServiceConfig) {
23    cfg.service(
24        web::scope("/api")
25            .route("/about", web::get().to(about::handle))
26            .route("/ops", web::get().to(ops_handler::handle))
27            .route("/formats", web::get().to(formats::handle))
28            .route("/read", web::post().to(read::handle))
29            .route("/nav", web::post().to(nav::handle))
30            .route("/defs", web::post().to(defs::handle))
31            .route("/libs", web::post().to(defs::handle_libs))
32            .route("/watchSub", web::post().to(watch::handle_sub))
33            .route("/watchPoll", web::post().to(watch::handle_poll))
34            .route("/watchUnsub", web::post().to(watch::handle_unsub))
35            .route("/pointWrite", web::post().to(point_write::handle))
36            .route("/hisRead", web::post().to(his::handle_read))
37            .route("/hisWrite", web::post().to(his::handle_write))
38            .route("/invokeAction", web::post().to(invoke::handle))
39            .route("/specs", web::post().to(libs::handle_specs))
40            .route("/spec", web::post().to(libs::handle_spec))
41            .route("/loadLib", web::post().to(libs::handle_load_lib))
42            .route("/unloadLib", web::post().to(libs::handle_unload_lib))
43            .route("/exportLib", web::post().to(libs::handle_export_lib))
44            .route("/validate", web::post().to(libs::handle_validate))
45            .route("/export", web::post().to(data::handle_export))
46            .route("/import", web::post().to(data::handle_import))
47            .route("/rdf/turtle", web::get().to(rdf::handle_turtle))
48            .route("/rdf/jsonld", web::get().to(rdf::handle_jsonld))
49            .route("/close", web::post().to(about::handle_close))
50            .service(
51                web::scope("/system")
52                    .route("/status", web::get().to(system::handle_status))
53                    .route("/backup", web::post().to(system::handle_backup))
54                    .route("/restore", web::post().to(system::handle_restore)),
55            )
56            .service(
57                web::scope("/federation")
58                    .route("/status", web::get().to(federation::handle_status))
59                    .route("/sync", web::post().to(federation::handle_sync)),
60            ),
61    );
62}