Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bragov4ik committed Aug 16, 2024
1 parent eeedcbc commit 99662d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions libs/blockscout-endpoints/health/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
//! Tools for setting up `/health` endpoint.
//!
//! ## Usage
//! (example can be seen in `stats-proto` crate in this repo)
//!
//! 1. In `build.rs` in your crateuse [`add_to_compile_config`],
//! [`proto_files`], and [`includes`] for compiling `health.proto`
//! to rust code using [`prost_build`].
//!
//! 2. To include the generated code in your project, add the following to `lib.rs`
//! (`/grpc.health.v1.rs` is the file name chosen based on `package` in `.proto` file):
//! ```ignore
//! pub mod grpc {
//! pub mod health {
//! pub mod v1 {
//! include!(concat!(env!("OUT_DIR"), "/grpc.health.v1.rs"));
//! }
//! }
//! }
//! ```
//!
//! 3. To enable swagger generation, add the following in `api_config_http.yaml`'s
//! http rules:
//! ```
//! - selector: grpc.health.v1.Health.Check
//! get: /health
//! ```
//!
//! Now the types should be available in `grpc::health::v1` module, and swagger
//! entry for the endpoint should appear

use std::path::{Path, PathBuf};

use prost_build::Config;
Expand Down

0 comments on commit 99662d0

Please sign in to comment.