b36ca2c4f1
* Adding the explorer API * Added explorer-api to workspace * Re-jigged explorer api cargo paths * Fixed compiler warnings * Removing unused code * network-explorer-api: configure state with env var API_STATE_FILE or fall back to default value of `explorer-api-state.json` * network-explorer-api: updates to `Cargo.lock` file after rebasing * network-explorer-api: make clippy happy
20 lines
424 B
Rust
20 lines
424 B
Rust
use rocket::serde::json::Json;
|
|
use rocket::Route;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
pub fn ping_make_default_routes() -> Vec<Route> {
|
|
routes_with_openapi![index]
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, JsonSchema)]
|
|
pub(crate) struct PingResponse {
|
|
response_time: u32,
|
|
}
|
|
|
|
#[openapi(tag = "ping")]
|
|
#[get("/")]
|
|
pub(crate) async fn index() -> Json<PingResponse> {
|
|
Json(PingResponse { response_time: 42 })
|
|
}
|