diff --git a/src/main.rs b/src/main.rs index 99373e6..dadab76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,8 @@ pub struct GetProgress { timestamp: i64, } +const VERSION: &str = env!("CARGO_PKG_VERSION"); + #[tokio::main] async fn main() { let pg_url: String = env::var("PG_URL") @@ -61,6 +63,7 @@ async fn main() { .route("/syncs/progress", put(update_progress)) .route("/syncs/progress/{document}", get(get_progress)) .route("/healthcheck", get(healthcheck)) + .route("/version", get(version)) .with_state(db_pool); // run it with hyper on localhost:3003 @@ -74,6 +77,10 @@ async fn root() -> &'static str { "KOreader sync server" } +async fn version() -> &'static str { + VERSION +} + async fn create_user( State(db_pool): State, Json(payload): Json,