Files
test-rust2/src/main.rs
2026-03-19 20:17:42 +09:00

20 lines
540 B
Rust

use actix_web::{web, App, HttpServer, HttpResponse, get};
use serde_json::json;
#[get("/")]
async fn index() -> HttpResponse {
HttpResponse::Ok().json(json!({"app": "test-rust2", "status": "running"}))
}
#[get("/health")]
async fn health() -> HttpResponse {
HttpResponse::Ok().json(json!({"status": "ok"}))
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
println!("test-rust2 running on port 8080");
HttpServer::new(|| App::new().service(index).service(health))
.bind("0.0.0.0:8080")?.run().await
}