Initial project setup (rust)

This commit is contained in:
ufo6849
2026-03-19 20:17:42 +09:00
parent c008ef855b
commit 6a6d2321d0
7 changed files with 219 additions and 0 deletions

19
src/main.rs Normal file
View File

@@ -0,0 +1,19 @@
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
}