Skip to content

Commit

Permalink
✨ add ping handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreedzt committed May 5, 2024
1 parent 0cf0cb2 commit 7b997df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mod profile;
mod system;
mod user;
mod version_update;
mod ping;

#[tokio::main]
async fn main() -> Result<()> {
Expand Down Expand Up @@ -121,6 +122,7 @@ async fn main() -> Result<()> {
.configure(profile_config)
.configure(person_config)
.configure(system_config)
.configure(ping::ping_config)
})
.bind(format!("0.0.0.0:{}", config.port))?
.run()
Expand Down
14 changes: 14 additions & 0 deletions src/ping.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use actix_web::{get, web, HttpResponse, Responder};
use tracing::{info, instrument};

pub fn ping_config(cfg: &mut web::ServiceConfig) {
cfg.service(ping);
}

#[instrument]
#[get("/ping")]
async fn ping() -> impl Responder {
info!("");

HttpResponse::Ok().body("pong!")
}

0 comments on commit 7b997df

Please sign in to comment.