From 78eb253ced519f5f6b4c5f7f229aac3747228046 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 25 Apr 2022 12:57:32 +0300 Subject: Add new endpoint /version Use this endpoint to compare the live version to the version on vcs From here on, the version should be updated regularly as well --- src/handlers.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/handlers.rs') diff --git a/src/handlers.rs b/src/handlers.rs index 93781e4..ae82441 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -361,6 +361,19 @@ pub async fn get_config(db: Db) -> Result { Ok(reply::with_status(reply::json(&db.config), StatusCode::OK)) } +/// GET /version +/// Returns the current project version, as defined in Cargo.toml +pub async fn get_version() -> Result { + Ok(reply::with_status( + reply::html(format!( + "{} - version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + )), + StatusCode::OK, + )) +} + /// GET /transaction /// Returns JSON array of transactions pub async fn list_transactions(db: Db) -> Result { -- cgit v1.2.3-70-g09d2