diff --git a/server/src/main.rs b/server/src/main.rs index e8cbe65..b0ea385 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -101,6 +101,7 @@ async fn main() -> Result<(), Error> { .route("/turtle/new", post(create_turtle)) .route("/turtle/update/:id", post(command)) .route("/turtle/client.lua", get(client)) + .route("/flush", get(flush)) .with_state(state.clone()); let listener = tokio::net::TcpListener::bind("0.0.0.0:48228").await.unwrap(); @@ -163,6 +164,12 @@ async fn write_to_disk(state: SharedControl) -> anyhow::Result<()> { Ok(()) } +async fn flush(State(state): State) -> &'static str { + write_to_disk(state).await.unwrap(); + + "ACK" +} + async fn shutdown_signal() { let ctrl_c = async { signal::ctrl_c()