stratum-server 0.9.28

The server code for the Rust Stratum (v1) implementation
Documentation
use async_std::task;
use stratum_types::Result;
use tide::Response;

//The <> here is state, so add to it as we need it.
pub async fn init_api_server() -> Result<()> {
    let mut app = tide::new();
    app.at("/ping").get(health_check);
    task::spawn(async move { app.listen("127.0.0.1:8081").await.unwrap() });
    Ok(())
}

async fn health_check(_req: tide::Request<()>) -> Response {
    Response::new(200)
}

//@todo 2 checks we want here.
//1. Basic healthcheck, literally just an http endoint /ping that returns 200
//2. More complex that checks all dependent services are working. That might be able to be saved by
//   whatever is implementing this above, but we can brainstorm more on this one.