Skip to content

Day 22 - Web开发

actix-web

rust
use actix_web::{web, App, HttpResponse};

async fn hello() -> HttpResponse {
    HttpResponse::Ok().body("Hello, Rust!")
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .route("/", web::get().to(hello))
    })
    .bind("127.0.0.1:8080")?
    .run()
    .await
}

📅 学习进度

Day主题状态
01-21基础
22Web开发
23数据库

本文为Rust 30天学习计划第22天内容

📚 导航

| ← Day 21 - 上一章 | Day 23 - 下一章 →

最后更新: